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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<'a, I> StreamOnce for &'a mut Iwhere
I: StreamOnce + ?Sized,
impl<'a, I> StreamOnce for &'a mut Iwhere
I: StreamOnce + ?Sized,
type Token = <I as StreamOnce>::Token
type Range = <I as StreamOnce>::Range
type Position = <I as StreamOnce>::Position
type Error = <I as StreamOnce>::Error
fn uncons(&mut self) -> Result<Self::Token, StreamErrorFor<Self>>
fn is_partial(&self) -> bool
Source§impl<'a, T> StreamOnce for &'a [T]
impl<'a, T> StreamOnce for &'a [T]
Source§impl<'a> StreamOnce for &'a str
impl<'a> StreamOnce for &'a str
Implementors§
Source§impl<'a, T> StreamOnce for SliceStream<'a, T>where
T: PartialEq + 'a,
impl<'a, T> StreamOnce for SliceStream<'a, T>where
T: PartialEq + 'a,
Source§impl<Input, X, S> StreamOnce for combine::stream::position::Stream<Input, X>where
Input: StreamOnce,
X: Positioner<Input::Token>,
S: StreamError<Input::Token, Input::Range>,
Input::Error: ParseError<Input::Token, Input::Range, X::Position, StreamError = S> + ParseError<Input::Token, Input::Range, Input::Position, StreamError = S>,
impl<Input, X, S> StreamOnce for combine::stream::position::Stream<Input, X>where
Input: StreamOnce,
X: Positioner<Input::Token>,
S: StreamError<Input::Token, Input::Range>,
Input::Error: ParseError<Input::Token, Input::Range, X::Position, StreamError = S> + ParseError<Input::Token, Input::Range, Input::Position, StreamError = S>,
type Token = <Input as StreamOnce>::Token
type Range = <Input as StreamOnce>::Range
type Position = <X as Positioner<<Input as StreamOnce>::Token>>::Position
type Error = <Input as StreamOnce>::Error
Source§impl<Input: Iterator> StreamOnce for IteratorStream<Input>
impl<Input: Iterator> StreamOnce for IteratorStream<Input>
Source§impl<Input> StreamOnce for combine::stream::buffered::Stream<Input>
Available on crate feature alloc only.
impl<Input> StreamOnce for combine::stream::buffered::Stream<Input>
Available on crate feature
alloc only.type Token = <Input as StreamOnce>::Token
type Range = <Input as StreamOnce>::Range
type Position = <Input as StreamOnce>::Position
type Error = <Input as StreamOnce>::Error
Source§impl<R: Read> StreamOnce for combine::stream::read::Stream<R>
Available on crate feature std only.
impl<R: Read> StreamOnce for combine::stream::read::Stream<R>
Available on crate feature
std only.Source§impl<S, E> StreamOnce for combine::stream::span::Stream<S, E>where
S: StreamOnce + Positioned,
S::Token: PartialEq,
S::Range: PartialEq,
E: ParseError<S::Token, S::Range, Span<S::Position>>,
S::Error: ParseErrorInto<S::Token, S::Range, S::Position>,
<S::Error as ParseError<S::Token, S::Range, S::Position>>::StreamError: StreamErrorInto<S::Token, S::Range>,
impl<S, E> StreamOnce for combine::stream::span::Stream<S, E>where
S: StreamOnce + Positioned,
S::Token: PartialEq,
S::Range: PartialEq,
E: ParseError<S::Token, S::Range, Span<S::Position>>,
S::Error: ParseErrorInto<S::Token, S::Range, S::Position>,
<S::Error as ParseError<S::Token, S::Range, S::Position>>::StreamError: StreamErrorInto<S::Token, S::Range>,
Source§impl<S, U> StreamOnce for combine::stream::state::Stream<S, U>where
S: StreamOnce,
impl<S, U> StreamOnce for combine::stream::state::Stream<S, U>where
S: StreamOnce,
type Token = <S as StreamOnce>::Token
type Range = <S as StreamOnce>::Range
type Position = <S as StreamOnce>::Position
type Error = <S as StreamOnce>::Error
Source§impl<S> StreamOnce for CompleteStream<S>where
S: StreamOnce,
impl<S> StreamOnce for CompleteStream<S>where
S: StreamOnce,
type Token = <S as StreamOnce>::Token
type Range = <S as StreamOnce>::Range
type Position = <S as StreamOnce>::Position
type Error = <S as StreamOnce>::Error
Source§impl<S> StreamOnce for MaybePartialStream<S>where
S: StreamOnce,
impl<S> StreamOnce for MaybePartialStream<S>where
S: StreamOnce,
type Token = <S as StreamOnce>::Token
type Range = <S as StreamOnce>::Range
type Position = <S as StreamOnce>::Position
type Error = <S as StreamOnce>::Error
Source§impl<S> StreamOnce for PartialStream<S>where
S: StreamOnce,
impl<S> StreamOnce for PartialStream<S>where
S: StreamOnce,
type Token = <S as StreamOnce>::Token
type Range = <S as StreamOnce>::Range
type Position = <S as StreamOnce>::Position
type Error = <S as StreamOnce>::Error
Source§impl<S> StreamOnce for combine::easy::Stream<S>
Available on crate feature std only.
impl<S> StreamOnce for combine::easy::Stream<S>
Available on crate feature
std only.