Enum icu_pattern::PatternToken
source · [−]Expand description
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 implementsFromStr
.
Lifetimes
s
: The life time of an input string slice being parsed.
Variants
Placeholder(P)
Literal
Trait Implementations
sourceimpl<'s, P: Clone> Clone for PatternToken<'s, P>
impl<'s, P: Clone> Clone for PatternToken<'s, P>
sourcefn clone(&self) -> PatternToken<'s, P>
fn clone(&self) -> PatternToken<'s, P>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'s, P: Debug> Debug for PatternToken<'s, P>
impl<'s, P: Debug> Debug for PatternToken<'s, P>
sourceimpl<'s, P: PartialEq> PartialEq<PatternToken<'s, P>> for PatternToken<'s, P>
impl<'s, P: PartialEq> PartialEq<PatternToken<'s, P>> for PatternToken<'s, P>
sourcefn eq(&self, other: &PatternToken<'s, P>) -> bool
fn eq(&self, other: &PatternToken<'s, P>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PatternToken<'s, P>) -> bool
fn ne(&self, other: &PatternToken<'s, P>) -> bool
This method tests for !=
.
impl<'s, P> StructuralPartialEq for PatternToken<'s, P>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more