Struct icu_capi::units_converter::ffi::UnitsConverterFactory
source · pub struct UnitsConverterFactory(pub ConverterFactory);
Expand description
An ICU4X Units Converter Factory object, capable of creating converters a UnitsConverter
for converting between two MeasureUnit
s.
Also, it can parse the CLDR unit identifier (e.g. meter-per-square-second
) and get the MeasureUnit
.
Tuple Fields§
§0: ConverterFactory
Implementations§
source§impl UnitsConverterFactory
impl UnitsConverterFactory
sourcepub fn create() -> Box<UnitsConverterFactory>
pub fn create() -> Box<UnitsConverterFactory>
Construct a new UnitsConverterFactory
instance using compiled data.
sourcepub fn create_with_provider(
provider: &DataProvider,
) -> Result<Box<UnitsConverterFactory>, DataError>
pub fn create_with_provider( provider: &DataProvider, ) -> Result<Box<UnitsConverterFactory>, DataError>
Construct a new UnitsConverterFactory
instance using a particular data source.
sourcepub fn converter(
&self,
from: &MeasureUnit,
to: &MeasureUnit,
) -> Option<Box<UnitsConverter>>
pub fn converter( &self, from: &MeasureUnit, to: &MeasureUnit, ) -> Option<Box<UnitsConverter>>
Creates a new UnitsConverter
from the input and output MeasureUnit
s.
Returns nothing if the conversion between the two units is not possible.
For example, conversion between meter
and second
is not possible.
sourcepub fn parser<'a>(&'a self) -> Box<MeasureUnitParser<'a>>
pub fn parser<'a>(&'a self) -> Box<MeasureUnitParser<'a>>
Creates a parser to parse the CLDR unit identifier (e.g. meter-per-square-second
) and get the MeasureUnit
.
Auto Trait Implementations§
impl Freeze for UnitsConverterFactory
impl RefUnwindSafe for UnitsConverterFactory
impl Send for UnitsConverterFactory
impl Sync for UnitsConverterFactory
impl Unpin for UnitsConverterFactory
impl UnwindSafe for UnitsConverterFactory
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more