Enum icu::pattern::SinglePlaceholderKey
source · pub enum SinglePlaceholderKey {
Singleton,
}
Expand description
A singleton enum for the SinglePlaceholder
pattern backend.
§Examples
use core::cmp::Ordering;
use core::str::FromStr;
use icu_pattern::PatternItem;
use icu_pattern::SinglePlaceholder;
use icu_pattern::SinglePlaceholderKey;
use icu_pattern::SinglePlaceholderPattern;
// Parse the string syntax and check the resulting data store:
let pattern = SinglePlaceholderPattern::try_from_str(
"Hello, {0}!",
Default::default(),
)
.unwrap();
assert_eq!(
pattern.iter().cmp(
[
PatternItem::Literal("Hello, "),
PatternItem::Placeholder(SinglePlaceholderKey::Singleton),
PatternItem::Literal("!")
]
.into_iter()
),
Ordering::Equal
);
Variants§
Singleton
Trait Implementations§
source§impl Clone for SinglePlaceholderKey
impl Clone for SinglePlaceholderKey
source§fn clone(&self) -> SinglePlaceholderKey
fn clone(&self) -> SinglePlaceholderKey
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SinglePlaceholderKey
impl Debug for SinglePlaceholderKey
source§impl<'de> Deserialize<'de> for SinglePlaceholderKey
impl<'de> Deserialize<'de> for SinglePlaceholderKey
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SinglePlaceholderKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SinglePlaceholderKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl FromStr for SinglePlaceholderKey
impl FromStr for SinglePlaceholderKey
source§type Err = Infallible
type Err = Infallible
The associated error which can be returned from parsing.
source§fn from_str(
_: &str,
) -> Result<SinglePlaceholderKey, <SinglePlaceholderKey as FromStr>::Err>
fn from_str( _: &str, ) -> Result<SinglePlaceholderKey, <SinglePlaceholderKey as FromStr>::Err>
Parses a string
s
to return a value of this type. Read moresource§impl Ord for SinglePlaceholderKey
impl Ord for SinglePlaceholderKey
source§fn cmp(&self, other: &SinglePlaceholderKey) -> Ordering
fn cmp(&self, other: &SinglePlaceholderKey) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for SinglePlaceholderKey
impl PartialEq for SinglePlaceholderKey
source§impl PartialOrd for SinglePlaceholderKey
impl PartialOrd for SinglePlaceholderKey
source§impl<W> PlaceholderValueProvider<SinglePlaceholderKey> for [W; 1]where
W: Writeable,
impl<W> PlaceholderValueProvider<SinglePlaceholderKey> for [W; 1]where
W: Writeable,
type Error = Infallible
source§fn value_for(
&self,
_key: SinglePlaceholderKey,
) -> <[W; 1] as PlaceholderValueProvider<SinglePlaceholderKey>>::W<'_>
fn value_for( &self, _key: SinglePlaceholderKey, ) -> <[W; 1] as PlaceholderValueProvider<SinglePlaceholderKey>>::W<'_>
Returns the
TryWriteable
to substitute for the given placeholder. Read moresource§fn map_literal<'a, 'l>(
&'a self,
literal: &'l str,
) -> <[W; 1] as PlaceholderValueProvider<SinglePlaceholderKey>>::L<'a, 'l>
fn map_literal<'a, 'l>( &'a self, literal: &'l str, ) -> <[W; 1] as PlaceholderValueProvider<SinglePlaceholderKey>>::L<'a, 'l>
source§impl<W> PlaceholderValueProvider<SinglePlaceholderKey> for (W,)where
W: Writeable,
impl<W> PlaceholderValueProvider<SinglePlaceholderKey> for (W,)where
W: Writeable,
type Error = Infallible
source§fn value_for(
&self,
_key: SinglePlaceholderKey,
) -> <(W,) as PlaceholderValueProvider<SinglePlaceholderKey>>::W<'_>
fn value_for( &self, _key: SinglePlaceholderKey, ) -> <(W,) as PlaceholderValueProvider<SinglePlaceholderKey>>::W<'_>
Returns the
TryWriteable
to substitute for the given placeholder. Read moresource§fn map_literal<'a, 'l>(
&'a self,
literal: &'l str,
) -> <(W,) as PlaceholderValueProvider<SinglePlaceholderKey>>::L<'a, 'l>
fn map_literal<'a, 'l>( &'a self, literal: &'l str, ) -> <(W,) as PlaceholderValueProvider<SinglePlaceholderKey>>::L<'a, 'l>
source§impl Serialize for SinglePlaceholderKey
impl Serialize for SinglePlaceholderKey
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for SinglePlaceholderKey
impl Eq for SinglePlaceholderKey
impl StructuralPartialEq for SinglePlaceholderKey
Auto Trait Implementations§
impl Freeze for SinglePlaceholderKey
impl RefUnwindSafe for SinglePlaceholderKey
impl Send for SinglePlaceholderKey
impl Sync for SinglePlaceholderKey
impl Unpin for SinglePlaceholderKey
impl UnwindSafe for SinglePlaceholderKey
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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