File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ use objc_encode:: { Encode , Encoding } ;
2
+
3
+ /// We don't know the size of NSString, so we can only hold pointers to it.
4
+ ///
5
+ /// TODO: Use [`extern type`][rfc-1861] when that gets stabilized.
6
+ ///
7
+ /// [rfc-1861]: https://rust-lang.github.io/rfcs/1861-extern-types.html
8
+ #[ repr( C ) ]
9
+ struct NSString {
10
+ _priv : [ u8 ; 0 ] ,
11
+ }
12
+
13
+ /// Implement `Encode` for references.
14
+ ///
15
+ /// This also implements for `*mut NSString` and `Option<&mut NSString>`.
16
+ unsafe impl < ' a > Encode for & ' a NSString {
17
+ const ENCODING : Encoding < ' static > = Encoding :: Object ;
18
+ }
19
+
20
+ /// Implement `Encode` for mutable references.
21
+ ///
22
+ /// This also implements for `*mut NSString` and `Option<&mut NSString>`.
23
+ unsafe impl < ' a > Encode for & ' a mut NSString {
24
+ const ENCODING : Encoding < ' static > = Encoding :: Object ;
25
+ }
You can’t perform that action at this time.
0 commit comments