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