29
29
#[ macro_export]
30
30
macro_rules! cf_type {
31
31
(
32
- #[ encoding_name = $encoding_name: expr]
33
32
unsafe impl $( <$( $generic: ident : ?$sized: ident) ,* $( , ) ?>) ? $ty: ident $( <$( $generic_param: ident) ,* $( , ) ?>) ? $( : $superclass: ty) ? { }
34
33
) => {
35
34
// Reflexive AsRef impl.
@@ -46,12 +45,6 @@ macro_rules! cf_type {
46
45
$crate:: __cf_type_needs_cf_base!( impl ( $( <$( $generic : ?$sized) ,* >) ?) $ty $( <$( $generic_param) ,* >) ?) ;
47
46
48
47
$crate:: __cf_type_superclass!( impl ( $( <$( $generic : ?$sized) ,* >) ?) $ty $( <$( $generic_param) ,* >) ? $( : $superclass) ?) ;
49
-
50
- // Objective-C interop
51
- $crate:: __cf_type_objc2!(
52
- impl ( $( <$( $generic : ?$sized) ,* >) ?) $ty $( <$( $generic_param) ,* >) ?,
53
- $crate:: __cf_macro_helpers:: Encoding :: Struct ( $encoding_name, & [ ] )
54
- ) ;
55
48
} ;
56
49
}
57
50
@@ -182,53 +175,3 @@ macro_rules! __cf_type_no_superclass {
182
175
macro_rules! __cf_type_no_superclass {
183
176
( impl ( $( $generics: tt) * ) $ty: ty) => { } ;
184
177
}
185
-
186
- #[ cfg( feature = "objc2" ) ]
187
- #[ doc( hidden) ]
188
- #[ macro_export]
189
- macro_rules! __cf_type_objc2 {
190
- ( impl ( $( $generics: tt) * ) $ty: ty, $encoding: expr) => {
191
- // SAFETY: Caller upholds that the struct is a ZST type, and
192
- // represents a C struct with the given encoding.
193
- unsafe impl $( $generics) * $crate:: __cf_macro_helpers:: RefEncode for $ty {
194
- const ENCODING_REF : $crate:: __cf_macro_helpers:: Encoding =
195
- $crate:: __cf_macro_helpers:: Encoding :: Pointer ( & $encoding) ;
196
- }
197
-
198
- // SAFETY: CF types are message-able in the Objective-C runtime.
199
- //
200
- // (Yes, even e.g. `CFArray<u32>`, though the return type from methods
201
- // might not be what's expected).
202
- unsafe impl $( $generics) * $crate:: __cf_macro_helpers:: Message for $ty { }
203
-
204
- // Allow converting to AnyObject.
205
- // Similar to objc2::__extern_class_impl_as_ref_borrow!
206
- impl $( $generics) * $crate:: __cf_macro_helpers:: AsRef <$crate:: __cf_macro_helpers:: AnyObject > for $ty {
207
- #[ inline]
208
- fn as_ref( & self ) -> & $crate:: __cf_macro_helpers:: AnyObject {
209
- // SAFETY: CF types are valid to re-interpret as AnyObject.
210
- unsafe { $crate:: __cf_macro_helpers:: transmute( self ) }
211
- }
212
- }
213
-
214
- impl $( $generics) * $crate:: __cf_macro_helpers:: Borrow <$crate:: __cf_macro_helpers:: AnyObject > for $ty {
215
- #[ inline]
216
- fn borrow( & self ) -> & $crate:: __cf_macro_helpers:: AnyObject {
217
- <Self as $crate:: __cf_macro_helpers:: AsRef <$crate:: __cf_macro_helpers:: AnyObject >>:: as_ref( self )
218
- }
219
- }
220
-
221
- // Do not implement `ClassType`, CoreFoundation objects are root
222
- // objects, and all inherit from the same (hidden) __NSCFType class.
223
- //
224
- // This also means that casting etc. must be implemented differently
225
- // for CoreFoundation objects (compare).
226
- } ;
227
- }
228
-
229
- #[ cfg( not( feature = "objc2" ) ) ]
230
- #[ doc( hidden) ]
231
- #[ macro_export]
232
- macro_rules! __cf_type_objc2 {
233
- ( $( $t: tt) * ) => { } ;
234
- }
0 commit comments