pub trait IteratorExt: Iterator<Item = Token> {
// Provided methods
fn filter_key_value_by_type(
self,
token_type: TokenType,
) -> FilterTypedKeyValuePairs<Self> ⓘ
where Self: Sized { ... }
fn reader(self, source: Option<&str>) -> TokenReader<'_, Self> ⓘ
where Self: Sized { ... }
}
Expand description
Applies convenience constructors to all Iterator<Item=Token>
types
Provided Methods§
Sourcefn filter_key_value_by_type(
self,
token_type: TokenType,
) -> FilterTypedKeyValuePairs<Self> ⓘwhere
Self: Sized,
fn filter_key_value_by_type(
self,
token_type: TokenType,
) -> FilterTypedKeyValuePairs<Self> ⓘwhere
Self: Sized,
Returns an Iterator which filters key=value pairs, if value.kind
matches
the given token_type
.
It is useful, for example, to get rid of null
values on a lexical level.
Sourcefn reader(self, source: Option<&str>) -> TokenReader<'_, Self> ⓘwhere
Self: Sized,
fn reader(self, source: Option<&str>) -> TokenReader<'_, Self> ⓘwhere
Self: Sized,
Returns a TokenReader
to produce a byte stream from Token
instances
§Arguments
source
- an optional, original string from which the tokens were generated. This offers the best performance when serializing tokens, as they can refer to their original&str
slice.