pub struct CFDateFormatter(/* private fields */);Expand description
Safe wrapper around a retained Core Foundation CFDateFormatter reference.
Implementations§
Source§impl CFDateFormatter
impl CFDateFormatter
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 CFDateFormatter pointer and returns None for null.
§Safety
A non-null ptr must be a live CFDateFormatter 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 CFDateFormatter pointer and returns an owned wrapper.
§Safety
A non-null ptr must be a live CFDateFormatter 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 CFDateFormatter
impl CFDateFormatter
Sourcepub fn new(
locale: Option<&CFLocale>,
date_style: CFDateFormatterStyle,
time_style: CFDateFormatterStyle,
) -> Self
pub fn new( locale: Option<&CFLocale>, date_style: CFDateFormatterStyle, time_style: CFDateFormatterStyle, ) -> Self
Create a date formatter for the given locale and styles.
Sourcepub fn format_date(&self, date: &CFDate) -> CFString
pub fn format_date(&self, date: &CFDate) -> CFString
Format a date into a localized string.
Trait Implementations§
Source§impl AsCFType for CFDateFormatter
impl AsCFType for CFDateFormatter
Source§impl Clone for CFDateFormatter
impl Clone for CFDateFormatter
Source§fn clone(&self) -> CFDateFormatter
fn clone(&self) -> CFDateFormatter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more