Enum icu_pattern::PatternToken[][src]

pub enum PatternToken<'s, P> {
    Placeholder(P),
    Literal {
        content: Cow<'s, str>,
        quoted: bool,
    },
}

A token returned by the Parser.

Examples

use icu_pattern::{Parser, ParserOptions, PatternToken};

let input = "{0}, {1}";

let mut parser = Parser::new(input, ParserOptions {
    allow_raw_letters: false
});

let mut result = vec![];

while let Some(element) = parser.try_next().expect("Failed to advance iterator") {
    result.push(element);
}

assert_eq!(result, &[
    PatternToken::Placeholder(0),
    PatternToken::Literal { content: ", ".into(), quoted: false },
    PatternToken::Placeholder(1),
]);

Type parameters

  • P: A placeholder type which implements FromStr.

Lifetimes

  • s: The life time of an input string slice being parsed.

Variants

Placeholder(P)
Literal
Show fields

Fields of Literal

content: Cow<'s, str>quoted: bool

Trait Implementations

impl<'s, P: Clone> Clone for PatternToken<'s, P>[src]

impl<'s, P: Debug> Debug for PatternToken<'s, P>[src]

impl<'s, P> From<(&'s str, bool)> for PatternToken<'s, P>[src]

impl<'s, P: PartialEq> PartialEq<PatternToken<'s, P>> for PatternToken<'s, P>[src]

impl<'s, P> StructuralPartialEq for PatternToken<'s, P>[src]

Auto Trait Implementations

impl<'s, P> RefUnwindSafe for PatternToken<'s, P> where
    P: RefUnwindSafe

impl<'s, P> Send for PatternToken<'s, P> where
    P: Send

impl<'s, P> Sync for PatternToken<'s, P> where
    P: Sync

impl<'s, P> Unpin for PatternToken<'s, P> where
    P: Unpin

impl<'s, P> UnwindSafe for PatternToken<'s, P> where
    P: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.