Trait Type

Source
pub unsafe trait Type {
    // Provided methods
    fn retain(&self) -> CFRetained<Self> 
       where Self: Sized { ... }
    fn as_concrete_TypeRef(&self) -> &Self { ... }
    unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self> 
       where Self: Sized { ... }
    fn as_CFTypeRef(&self) -> &CFType
       where Self: AsRef<CFType> { ... }
    unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self> 
       where Self: Sized { ... }
}
Expand description

A CoreFoundation-like type.

This trait is implemented for all CoreFoundation-like types (i.e. both types in this crate like CFString, but also types from other frameworks like CGColor from CoreGraphics).

This trait allows the type to be used in CFRetained.

You should not need to implement this yourself.

§Safety

  • The type must be a CoreFoundation-like type.
  • The type must be safe to retain/release using CFRetain and CFRelease.

Provided Methods§

Source

fn retain(&self) -> CFRetained<Self>
where Self: Sized,

Increment the reference count of the receiver.

This extends the duration in which the receiver is alive by detaching it from the lifetime information carried by the reference.

This is similar to using Clone on CFRetained<Self>, with the addition that it can be used on a plain reference.

Source

fn as_concrete_TypeRef(&self) -> &Self

👎Deprecated: this is redundant

Helper for easier transition from the core-foundation crate.

Source

unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::retain

Helper for easier transition from the core-foundation crate.

§Safety

Same as CFRetained::retain.

Source

fn as_CFTypeRef(&self) -> &CFType
where Self: AsRef<CFType>,

👎Deprecated: this is redundant (CF types deref to CFType)

Helper for easier transition from the core-foundation crate.

Source

unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::from_raw

Helper for easier transition from the core-foundation crate.

§Safety

Same as CFRetained::from_raw.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Type for CFAllocator

Source§

impl Type for CFAttributedString

Available on crate feature CFAttributedString only.
Source§

impl Type for CFBitVector

Available on crate feature CFBitVector only.
Source§

impl Type for CFBoolean

Available on crate feature CFNumber only.
Source§

impl Type for CFBundle

Available on crate feature CFBundle only.
Source§

impl Type for CFCalendar

Available on crate feature CFCalendar only.
Source§

impl Type for CFCharacterSet

Available on crate feature CFCharacterSet only.
Source§

impl Type for CFData

Available on crate feature CFData only.
Source§

impl Type for CFDate

Available on crate feature CFDate only.
Source§

impl Type for CFDateFormatter

Available on crate feature CFDateFormatter only.
Source§

impl Type for CFError

Available on crate feature CFError only.
Source§

impl Type for CFFileDescriptor

Available on crate feature CFFileDescriptor only.
Source§

impl Type for CFFileSecurity

Available on crate feature CFFileSecurity only.
Source§

impl Type for CFLocale

Available on crate feature CFLocale only.
Source§

impl Type for CFMachPort

Available on crate feature CFMachPort only.
Source§

impl Type for CFMessagePort

Available on crate feature CFMessagePort only.
Source§

impl Type for CFMutableAttributedString

Available on crate feature CFAttributedString only.
Source§

impl Type for CFMutableBitVector

Available on crate feature CFBitVector only.
Source§

impl Type for CFMutableCharacterSet

Available on crate feature CFCharacterSet only.
Source§

impl Type for CFMutableData

Available on crate feature CFData only.
Source§

impl Type for CFMutableString

Source§

impl Type for CFNotificationCenter

Available on crate feature CFNotificationCenter only.
Source§

impl Type for CFNull

Source§

impl Type for CFNumber

Available on crate feature CFNumber only.
Source§

impl Type for CFNumberFormatter

Available on crate feature CFNumberFormatter only.
Source§

impl Type for CFPlugIn

Available on crate feature CFBundle only.
Source§

impl Type for CFPlugInInstance

Available on crate feature CFPlugIn only.
Source§

impl Type for CFReadStream

Available on crate feature CFStream only.
Source§

impl Type for CFRunLoop

Available on crate feature CFRunLoop only.
Source§

impl Type for CFRunLoopObserver

Available on crate feature CFRunLoop only.
Source§

impl Type for CFRunLoopSource

Available on crate feature CFRunLoop only.
Source§

impl Type for CFRunLoopTimer

Available on crate feature CFRunLoop only.
Source§

impl Type for CFSocket

Available on crate feature CFSocket only.
Source§

impl Type for CFString

Source§

impl Type for CFStringTokenizer

Available on crate feature CFStringTokenizer only.
Source§

impl Type for CFTimeZone

Available on crate feature CFDate only.
Source§

impl Type for CFTree

Available on crate feature CFTree only.
Source§

impl Type for CFType

Source§

impl Type for CFURL

Available on crate feature CFURL only.
Source§

impl Type for CFURLEnumerator

Available on crate feature CFURLEnumerator only.
Source§

impl Type for CFUUID

Available on crate feature CFUUID only.
Source§

impl Type for CFUserNotification

Available on crate feature CFUserNotification only.
Source§

impl Type for CFWriteStream

Available on crate feature CFStream only.
Source§

impl Type for CFXMLNode

Available on crate feature CFXMLNode only.
Source§

impl Type for CFXMLParser

Available on crate feature CFXMLParser only.
Source§

impl<K: ?Sized, V: ?Sized> Type for CFDictionary<K, V>

Available on crate feature CFDictionary only.
Source§

impl<K: ?Sized, V: ?Sized> Type for CFMutableDictionary<K, V>

Available on crate feature CFDictionary only.
Source§

impl<T: ?Sized> Type for CFArray<T>

Available on crate feature CFArray only.
Source§

impl<T: ?Sized> Type for CFBag<T>

Available on crate feature CFBag only.
Source§

impl<T: ?Sized> Type for CFBinaryHeap<T>

Available on crate feature CFBinaryHeap only.
Source§

impl<T: ?Sized> Type for CFMutableArray<T>

Available on crate feature CFArray only.
Source§

impl<T: ?Sized> Type for CFMutableBag<T>

Available on crate feature CFBag only.
Source§

impl<T: ?Sized> Type for CFMutableSet<T>

Available on crate feature CFSet only.
Source§

impl<T: ?Sized> Type for CFSet<T>

Available on crate feature CFSet only.