Struct combine::stream::buffered::Stream [−][src]
pub struct Stream<Input> where
Input: StreamOnce + Positioned, { /* fields omitted */ }
Expand description
Stream
which buffers items from an instance of StreamOnce
into a ring buffer.
Instances of StreamOnce
which is not able to implement ResetStream
(such as ReadStream
) may
use this as a way to implement ResetStream
and become a full Stream
instance.
The drawback is that the buffer only stores a limited number of items which limits how many
tokens that can be reset and replayed. If a buffered::Stream
is reset past this limit an error
will be returned when uncons
is next called.
NOTE: If this stream is used in conjunction with an error enhancing stream such as
easy::Stream
(also via the easy_parser
method) it is recommended that the buffered::Stream
instance wraps the easy::Stream
instance instead of the other way around.
// DO buffered::Stream::new(easy::Stream(..), ..) // DON'T easy::Stream(buffered::Stream::new(.., ..)) parser.easy_parse(buffered::Stream::new(..));
Implementations
impl<Input> Stream<Input> where
Input: StreamOnce + Positioned,
Input::Position: Clone,
Input::Token: Clone,
impl<Input> Stream<Input> where
Input: StreamOnce + Positioned,
Input::Position: Clone,
Input::Token: Clone,
Trait Implementations
impl<Input: Debug> Debug for Stream<Input> where
Input: StreamOnce + Positioned,
Input::Token: Debug,
Input::Position: Debug,
impl<Input: Debug> Debug for Stream<Input> where
Input: StreamOnce + Positioned,
Input::Token: Debug,
Input::Position: Debug,
type Checkpoint = usize
Creates a Checkpoint
at the current position which can be used to reset the stream
later to the current position Read more
impl<Input> StreamOnce for Stream<Input> where
Input: StreamOnce + Positioned,
Input::Token: Clone,
impl<Input> StreamOnce for Stream<Input> where
Input: StreamOnce + Positioned,
Input::Token: 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. Read more
Type which represents the position in a stream.
Ord
is required to allow parsers to determine which of two positions are further ahead. Read more
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. Read more
Returns true
if this stream only contains partial input. Read more
Auto Trait Implementations
impl<Input> RefUnwindSafe for Stream<Input> where
Input: RefUnwindSafe,
<Input as StreamOnce>::Position: RefUnwindSafe,
<Input as StreamOnce>::Token: RefUnwindSafe,
impl<Input> Send for Stream<Input> where
Input: Send,
<Input as StreamOnce>::Position: Send,
<Input as StreamOnce>::Token: Send,
impl<Input> Sync for Stream<Input> where
Input: Sync,
<Input as StreamOnce>::Position: Sync,
<Input as StreamOnce>::Token: Sync,
impl<Input> Unpin for Stream<Input> where
Input: Unpin,
<Input as StreamOnce>::Position: Unpin,
<Input as StreamOnce>::Token: Unpin,
impl<Input> UnwindSafe for Stream<Input> where
Input: UnwindSafe,
<Input as StreamOnce>::Position: UnwindSafe,
<Input as StreamOnce>::Token: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more