pub struct Value(ShortBoxSlice<TinyAsciiStr<{ _ }>>);
Expand description
A value used in a list of Fields
.
The value has to be a sequence of one or more alphanumerical strings
separated by -
.
Each part of the sequence has to be no shorter than three characters and no
longer than 8.
§Examples
use icu::locid::extensions::transform::Value;
"hybrid".parse::<Value>().expect("Valid Value.");
"hybrid-foobar".parse::<Value>().expect("Valid Value.");
"no".parse::<Value>().expect_err("Invalid Value.");
Tuple Fields§
§0: ShortBoxSlice<TinyAsciiStr<{ _ }>>
Implementations§
source§impl Value
impl Value
sourcepub fn try_from_bytes(input: &[u8]) -> Result<Self, ParserError>
pub fn try_from_bytes(input: &[u8]) -> Result<Self, ParserError>
pub(crate) fn from_short_slice_unchecked( input: ShortBoxSlice<TinyAsciiStr<{ _ }>>, ) -> Self
pub(crate) fn is_type_subtag(t: &[u8]) -> bool
pub(crate) fn parse_subtag( t: &[u8], ) -> Result<Option<TinyAsciiStr<{ _ }>>, ParserError>
pub(crate) fn for_each_subtag_str<E, F>(&self, f: &mut F) -> Result<(), E>
Trait Implementations§
source§impl Display for Value
impl Display for Value
This trait is implemented for compatibility with fmt!
.
To create a string, [Writeable::write_to_string
] is usually more efficient.
source§impl Ord for Value
impl Ord for Value
source§impl PartialEq for Value
impl PartialEq for Value
source§impl PartialOrd for Value
impl PartialOrd for Value
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Writeable for Value
impl Writeable for Value
source§fn write_to<W: Write + ?Sized>(&self, sink: &mut W) -> Result
fn write_to<W: Write + ?Sized>(&self, sink: &mut W) -> Result
Writes a string to the given sink. Errors from the sink are bubbled up.
The default implementation delegates to
write_to_parts
, and discards any
Part
annotations.source§fn writeable_length_hint(&self) -> LengthHint
fn writeable_length_hint(&self) -> LengthHint
Returns a hint for the number of UTF-8 bytes that will be written to the sink. Read more
source§fn write_to_string(&self) -> Cow<'_, str>
fn write_to_string(&self) -> Cow<'_, str>
Creates a new
String
with the data from this Writeable
. Like ToString
,
but smaller and faster. Read moresource§fn write_to_parts<S>(&self, sink: &mut S) -> Result<(), Error>where
S: PartsWrite + ?Sized,
fn write_to_parts<S>(&self, sink: &mut S) -> Result<(), Error>where
S: PartsWrite + ?Sized,
Write bytes and
Part
annotations to the given sink. Errors from the
sink are bubbled up. The default implementation delegates to write_to
,
and doesn’t produce any Part
annotations.impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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