Vendor things

This commit is contained in:
John Doty 2024-03-08 11:03:01 -08:00
parent 5deceec006
commit 977e3c17e5
19434 changed files with 10682014 additions and 0 deletions

View file

@ -0,0 +1,25 @@
use objc2_encode::{Encode, Encoding, RefEncode};
/// We don't know the size of NSString, so we can only hold pointers to it.
///
/// TODO: Use [`extern type`][rfc-1861] when that gets stabilized.
///
/// [rfc-1861]: https://rust-lang.github.io/rfcs/1861-extern-types.html
#[repr(C)]
struct NSString {
_priv: [u8; 0],
}
/// Implement `RefEncode` for pointers and references to the string.
unsafe impl RefEncode for NSString {
const ENCODING_REF: Encoding = Encoding::Object;
}
fn main() {
println!("{}", <*const NSString>::ENCODING);
println!("{}", <*mut NSString>::ENCODING);
println!("{}", <&NSString>::ENCODING);
println!("{}", <&mut NSString>::ENCODING);
println!("{}", Option::<&NSString>::ENCODING);
println!("{}", Option::<&mut NSString>::ENCODING);
}