Struct icu::pattern::MultiNamedPlaceholderKey
source · #[repr(transparent)]pub struct MultiNamedPlaceholderKey<'a>(pub &'a str);
Expand description
A string wrapper for the MultiNamedPlaceholder
pattern backend.
§Examples
use core::cmp::Ordering;
use core::str::FromStr;
use icu_pattern::MultiNamedPlaceholderKey;
use icu_pattern::MultiNamedPlaceholderPattern;
use icu_pattern::PatternItem;
// Parse the string syntax and check the resulting data store:
let pattern = MultiNamedPlaceholderPattern::try_from_str(
"Hello, {person0} and {person1}!", Default::default()
)
.unwrap();
assert_eq!(
pattern.iter().cmp(
[
PatternItem::Literal("Hello, "),
PatternItem::Placeholder(MultiNamedPlaceholderKey(
"person0".into()
)),
PatternItem::Literal(" and "),
PatternItem::Placeholder(MultiNamedPlaceholderKey(
"person1".into()
)),
PatternItem::Literal("!")
]
.into_iter()
),
Ordering::Equal
);
Tuple Fields§
§0: &'a str
Trait Implementations§
source§impl<'a> Clone for MultiNamedPlaceholderKey<'a>
impl<'a> Clone for MultiNamedPlaceholderKey<'a>
source§fn clone(&self) -> MultiNamedPlaceholderKey<'a>
fn clone(&self) -> MultiNamedPlaceholderKey<'a>
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<'a> Debug for MultiNamedPlaceholderKey<'a>
impl<'a> Debug for MultiNamedPlaceholderKey<'a>
source§impl<'a> Ord for MultiNamedPlaceholderKey<'a>
impl<'a> Ord for MultiNamedPlaceholderKey<'a>
source§fn cmp(&self, other: &MultiNamedPlaceholderKey<'a>) -> Ordering
fn cmp(&self, other: &MultiNamedPlaceholderKey<'a>) -> 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<'a> PartialEq for MultiNamedPlaceholderKey<'a>
impl<'a> PartialEq for MultiNamedPlaceholderKey<'a>
source§fn eq(&self, other: &MultiNamedPlaceholderKey<'a>) -> bool
fn eq(&self, other: &MultiNamedPlaceholderKey<'a>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.source§impl<'a> PartialOrd for MultiNamedPlaceholderKey<'a>
impl<'a> PartialOrd for MultiNamedPlaceholderKey<'a>
source§impl<'k, K, W> PlaceholderValueProvider<MultiNamedPlaceholderKey<'k>> for BTreeMap<K, W>
impl<'k, K, W> PlaceholderValueProvider<MultiNamedPlaceholderKey<'k>> for BTreeMap<K, W>
type Error = MissingNamedPlaceholderError<'k>
type W<'a> = Result<&'a W, <BTreeMap<K, W> as PlaceholderValueProvider<MultiNamedPlaceholderKey<'k>>>::Error> where W: 'a, BTreeMap<K, W>: 'a
const LITERAL_PART: Part = crate::PATTERN_LITERAL_PART
source§fn value_for<'a>(
&'a self,
key: MultiNamedPlaceholderKey<'k>,
) -> (<BTreeMap<K, W> as PlaceholderValueProvider<MultiNamedPlaceholderKey<'k>>>::W<'a>, Part)
fn value_for<'a>( &'a self, key: MultiNamedPlaceholderKey<'k>, ) -> (<BTreeMap<K, W> as PlaceholderValueProvider<MultiNamedPlaceholderKey<'k>>>::W<'a>, Part)
Returns the
TryWriteable
to substitute for the given placeholder
and the Part
representing it.source§impl<'k, K, W, S> PlaceholderValueProvider<MultiNamedPlaceholderKey<'k>> for LiteMap<K, W, S>
impl<'k, K, W, S> PlaceholderValueProvider<MultiNamedPlaceholderKey<'k>> for LiteMap<K, W, S>
type Error = MissingNamedPlaceholderError<'k>
type W<'a> = Result<&'a W, <LiteMap<K, W, S> as PlaceholderValueProvider<MultiNamedPlaceholderKey<'k>>>::Error> where W: 'a, LiteMap<K, W, S>: 'a
const LITERAL_PART: Part = crate::PATTERN_LITERAL_PART
source§fn value_for<'a>(
&'a self,
key: MultiNamedPlaceholderKey<'k>,
) -> (<LiteMap<K, W, S> as PlaceholderValueProvider<MultiNamedPlaceholderKey<'k>>>::W<'a>, Part)
fn value_for<'a>( &'a self, key: MultiNamedPlaceholderKey<'k>, ) -> (<LiteMap<K, W, S> as PlaceholderValueProvider<MultiNamedPlaceholderKey<'k>>>::W<'a>, Part)
Returns the
TryWriteable
to substitute for the given placeholder
and the Part
representing it.impl<'a> Eq for MultiNamedPlaceholderKey<'a>
impl<'a> StructuralPartialEq for MultiNamedPlaceholderKey<'a>
Auto Trait Implementations§
impl<'a> Freeze for MultiNamedPlaceholderKey<'a>
impl<'a> RefUnwindSafe for MultiNamedPlaceholderKey<'a>
impl<'a> Send for MultiNamedPlaceholderKey<'a>
impl<'a> Sync for MultiNamedPlaceholderKey<'a>
impl<'a> Unpin for MultiNamedPlaceholderKey<'a>
impl<'a> UnwindSafe for MultiNamedPlaceholderKey<'a>
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