Type Alias icu::pattern::MultiNamedPlaceholderPattern

source ·
pub type MultiNamedPlaceholderPattern = Pattern<MultiNamedPlaceholder>;
Expand description

§Examples

use core::str::FromStr;
use icu_pattern::MultiNamedPlaceholderPattern;
use std::collections::BTreeMap;
use writeable::assert_try_writeable_eq;

// Create a pattern from the string syntax:
let pattern = MultiNamedPlaceholderPattern::try_from_str(
    "Hello, {person0} and {person1}!", Default::default()
)
.unwrap();

// Interpolate some values into the pattern:
assert_try_writeable_eq!(
    pattern.try_interpolate(
        [("person0", "Alice"), ("person1", "Bob")]
            .into_iter()
            .collect::<BTreeMap<&str, &str>>()
    ),
    "Hello, Alice and Bob!"
);

Aliased Type§

struct MultiNamedPlaceholderPattern {
    pub store: str,
    /* private fields */
}

Fields§

§store: str

The encoded storage