Enum icu::pattern::DoublePlaceholderKey
source · pub enum DoublePlaceholderKey {
Place0,
Place1,
}
Expand description
A two-value enum for the DoublePlaceholder
pattern backend.
§Examples
use core::cmp::Ordering;
use core::str::FromStr;
use icu_pattern::DoublePlaceholderKey;
use icu_pattern::DoublePlaceholderPattern;
use icu_pattern::PatternItem;
// Parse the string syntax
let pattern =
DoublePlaceholderPattern::try_from_str("Hello, {0} and {1}!", Default::default()).unwrap();
assert_eq!(
pattern.iter().cmp(
[
PatternItem::Literal("Hello, "),
PatternItem::Placeholder(DoublePlaceholderKey::Place0),
PatternItem::Literal(" and "),
PatternItem::Placeholder(DoublePlaceholderKey::Place1),
PatternItem::Literal("!")
]
.into_iter()
),
Ordering::Equal
);
Variants§
Trait Implementations§
source§impl Clone for DoublePlaceholderKey
impl Clone for DoublePlaceholderKey
source§fn clone(&self) -> DoublePlaceholderKey
fn clone(&self) -> DoublePlaceholderKey
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 DoublePlaceholderKey
impl Debug for DoublePlaceholderKey
source§impl<'de> Deserialize<'de> for DoublePlaceholderKey
impl<'de> Deserialize<'de> for DoublePlaceholderKey
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DoublePlaceholderKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DoublePlaceholderKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl FromStr for DoublePlaceholderKey
impl FromStr for DoublePlaceholderKey
source§type Err = PatternError
type Err = PatternError
The associated error which can be returned from parsing.
source§fn from_str(
s: &str,
) -> Result<DoublePlaceholderKey, <DoublePlaceholderKey as FromStr>::Err>
fn from_str( s: &str, ) -> Result<DoublePlaceholderKey, <DoublePlaceholderKey as FromStr>::Err>
Parses a string
s
to return a value of this type. Read moresource§impl Ord for DoublePlaceholderKey
impl Ord for DoublePlaceholderKey
source§fn cmp(&self, other: &DoublePlaceholderKey) -> Ordering
fn cmp(&self, other: &DoublePlaceholderKey) -> 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 DoublePlaceholderKey
impl PartialEq for DoublePlaceholderKey
source§impl PartialOrd for DoublePlaceholderKey
impl PartialOrd for DoublePlaceholderKey
source§impl<W> PlaceholderValueProvider<DoublePlaceholderKey> for [W; 2]where
W: Writeable,
impl<W> PlaceholderValueProvider<DoublePlaceholderKey> for [W; 2]where
W: Writeable,
type Error = Infallible
type W<'a> = WriteableAsTryWriteableInfallible<&'a W> where W: 'a
const LITERAL_PART: Part = crate::PATTERN_LITERAL_PART
source§fn value_for(
&self,
key: DoublePlaceholderKey,
) -> (<[W; 2] as PlaceholderValueProvider<DoublePlaceholderKey>>::W<'_>, Part)
fn value_for( &self, key: DoublePlaceholderKey, ) -> (<[W; 2] as PlaceholderValueProvider<DoublePlaceholderKey>>::W<'_>, Part)
Returns the
TryWriteable
to substitute for the given placeholder
and the Part
representing it.source§impl<W0, W1> PlaceholderValueProvider<DoublePlaceholderKey> for (W0, W1)
impl<W0, W1> PlaceholderValueProvider<DoublePlaceholderKey> for (W0, W1)
type Error = Infallible
type W<'a> = WriteableAsTryWriteableInfallible<Either<&'a W0, &'a W1>> where W0: 'a, W1: 'a
const LITERAL_PART: Part = crate::PATTERN_LITERAL_PART
source§fn value_for(
&self,
key: DoublePlaceholderKey,
) -> (<(W0, W1) as PlaceholderValueProvider<DoublePlaceholderKey>>::W<'_>, Part)
fn value_for( &self, key: DoublePlaceholderKey, ) -> (<(W0, W1) as PlaceholderValueProvider<DoublePlaceholderKey>>::W<'_>, Part)
Returns the
TryWriteable
to substitute for the given placeholder
and the Part
representing it.source§impl Serialize for DoublePlaceholderKey
impl Serialize for DoublePlaceholderKey
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 DoublePlaceholderKey
impl Eq for DoublePlaceholderKey
impl StructuralPartialEq for DoublePlaceholderKey
Auto Trait Implementations§
impl Freeze for DoublePlaceholderKey
impl RefUnwindSafe for DoublePlaceholderKey
impl Send for DoublePlaceholderKey
impl Sync for DoublePlaceholderKey
impl Unpin for DoublePlaceholderKey
impl UnwindSafe for DoublePlaceholderKey
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