2929#[ macro_export]
3030macro_rules! cf_type {
3131 (
32- #[ encoding_name = $encoding_name: expr]
3332 unsafe impl $( <$( $generic: ident : ?$sized: ident) ,* $( , ) ?>) ? $ty: ident $( <$( $generic_param: ident) ,* $( , ) ?>) ? $( : $superclass: ty) ? { }
3433 ) => {
3534 // Reflexive AsRef impl.
@@ -46,12 +45,6 @@ macro_rules! cf_type {
4645 $crate:: __cf_type_needs_cf_base!( impl ( $( <$( $generic : ?$sized) ,* >) ?) $ty $( <$( $generic_param) ,* >) ?) ;
4746
4847 $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- ) ;
5548 } ;
5649}
5750
@@ -182,53 +175,3 @@ macro_rules! __cf_type_no_superclass {
182175macro_rules! __cf_type_no_superclass {
183176 ( impl ( $( $generics: tt) * ) $ty: ty) => { } ;
184177}
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