pub trait StreamOnce {
type Token: Clone;
type Range: Clone;
type Position: Clone + Ord;
type Error: ParseError<Self::Token, Self::Range, Self::Position>;
// Required method
fn uncons(&mut self) -> Result<Self::Token, StreamErrorFor<Self>>;
// Provided method
fn is_partial(&self) -> bool { ... }
}
Expand description
StreamOnce
represents a sequence of items that can be extracted one by one.
Required Associated Types§
sourcetype Range: Clone
type Range: Clone
The type of a range of items yielded from this stream.
Types which do not a have a way of yielding ranges of items should just use the
Self::Token
for this type.
sourcetype Position: Clone + Ord
type Position: Clone + Ord
Type which represents the position in a stream.
Ord
is required to allow parsers to determine which of two positions are further ahead.
type Error: ParseError<Self::Token, Self::Range, Self::Position>
Required Methods§
sourcefn uncons(&mut self) -> Result<Self::Token, StreamErrorFor<Self>>
fn uncons(&mut self) -> Result<Self::Token, StreamErrorFor<Self>>
Takes a stream and removes its first token, yielding the token and the rest of the elements.
Returns Err
if no element could be retrieved.
Provided Methods§
sourcefn is_partial(&self) -> bool
fn is_partial(&self) -> bool
Returns true
if this stream only contains partial input.
See PartialStream
.