Struct icu::experimental::measure::parser::MeasureUnitParser
source · pub struct MeasureUnitParser<'data> { /* private fields */ }
Expand description
A parser for the CLDR unit identifier (e.g. meter-per-square-second
)
Implementations§
source§impl<'data> MeasureUnitParser<'data>
impl<'data> MeasureUnitParser<'data>
sourcepub fn from_payload(
payload: &'data ZeroTrieSimpleAscii<[u8]>,
) -> MeasureUnitParser<'data>
pub fn from_payload( payload: &'data ZeroTrieSimpleAscii<[u8]>, ) -> MeasureUnitParser<'data>
Creates a new MeasureUnitParser from a ZeroTrie payload.
sourcepub fn try_from_str(&self, s: &str) -> Result<MeasureUnit, InvalidUnitError>
pub fn try_from_str(&self, s: &str) -> Result<MeasureUnit, InvalidUnitError>
Parses a CLDR unit identifier and returns a MeasureUnit.
Examples include: meter
, foot
, meter-per-second
, meter-per-square-second
, meter-per-square-second-per-second
, etc.
Returns:
- Ok(MeasureUnit) if the identifier is valid.
- Err(InvalidUnitError) if the identifier is invalid.
sourcepub fn try_from_utf8(
&self,
code_units: &[u8],
) -> Result<MeasureUnit, InvalidUnitError>
pub fn try_from_utf8( &self, code_units: &[u8], ) -> Result<MeasureUnit, InvalidUnitError>
Auto Trait Implementations§
impl<'data> Freeze for MeasureUnitParser<'data>
impl<'data> RefUnwindSafe for MeasureUnitParser<'data>
impl<'data> Send for MeasureUnitParser<'data>
impl<'data> Sync for MeasureUnitParser<'data>
impl<'data> Unpin for MeasureUnitParser<'data>
impl<'data> UnwindSafe for MeasureUnitParser<'data>
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