pub struct CFDate(/* private fields */);Expand description
Safe wrapper around a retained Core Foundation CFDate reference.
Implementations§
Source§impl CFDate
impl CFDate
Sourcepub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
Adopts a +1 retained CFDate pointer and returns None for null.
§Safety
A non-null ptr must be a live CFDate pointer of the exact dynamic type carrying one retain transferred to this wrapper. The caller must not release or separately adopt that transferred retain.
Sourcepub unsafe fn from_raw_borrowed(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_raw_borrowed(ptr: *mut c_void) -> Option<Self>
Retains a +0 borrowed CFDate pointer and returns an owned wrapper.
§Safety
A non-null ptr must be a live CFDate pointer of the exact dynamic type for the duration of the retain call.
Sourcepub const fn as_ptr(&self) -> *mut c_void
pub const fn as_ptr(&self) -> *mut c_void
Borrows the raw +0 Core Foundation pointer while self remains alive.
Sourcepub fn into_cf_type(self) -> CFType
pub fn into_cf_type(self) -> CFType
Consumes this wrapper and returns the erased CFType.
Source§impl CFDate
impl CFDate
Sourcepub fn from_absolute_time(absolute_time: f64) -> Self
pub fn from_absolute_time(absolute_time: f64) -> Self
Create a date from Core Foundation absolute time (seconds since 2001-01-01 00:00:00 UTC).
Sourcepub fn from_system_time(time: SystemTime) -> Self
pub fn from_system_time(time: SystemTime) -> Self
Convert from a Rust SystemTime.
Sourcepub fn absolute_time(&self) -> f64
pub fn absolute_time(&self) -> f64
Core Foundation absolute time.
Sourcepub fn to_system_time(&self) -> Option<SystemTime>
pub fn to_system_time(&self) -> Option<SystemTime>
Convert to SystemTime when representable.