[−][src]Struct combine::stream::buffered::Stream
std only.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, [src]
Input: StreamOnce + Positioned,
Input::Position: Clone,
Input::Token: Clone,
pub fn new(iter: Input, lookahead: usize) -> Stream<Input>[src]
Constructs a new BufferedStream from a StreamOnce instance with a lookahead
number of elements that can be stored in the buffer.
Trait Implementations
impl<Input: Debug> Debug for Stream<Input> where
Input: StreamOnce + Positioned,
Input::Token: Debug,
Input::Position: Debug, [src]
Input: StreamOnce + Positioned,
Input::Token: Debug,
Input::Position: Debug,
impl<Input: PartialEq> PartialEq<Stream<Input>> for Stream<Input> where
Input: StreamOnce + Positioned,
Input::Token: PartialEq,
Input::Position: PartialEq, [src]
Input: StreamOnce + Positioned,
Input::Token: PartialEq,
Input::Position: PartialEq,
pub fn eq(&self, other: &Stream<Input>) -> bool[src]
pub fn ne(&self, other: &Stream<Input>) -> bool[src]
impl<Input> Positioned for Stream<Input> where
Input: StreamOnce + Positioned, [src]
Input: StreamOnce + Positioned,
impl<Input> ResetStream for Stream<Input> where
Input: Positioned, [src]
Input: Positioned,
type Checkpoint = usize
pub fn checkpoint(&self) -> Self::Checkpoint[src]
pub fn reset(&mut self, checkpoint: Self::Checkpoint) -> Result<(), Self::Error>[src]
impl<Input> StreamOnce for Stream<Input> where
Input: StreamOnce + Positioned,
Input::Token: Clone, [src]
Input: StreamOnce + Positioned,
Input::Token: Clone,
type Token = Input::Token
The type of items which is yielded from this stream.
type Range = Input::Range
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 Position = Input::Position
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
type Error = Input::Error
pub fn uncons(&mut self) -> Result<Input::Token, StreamErrorFor<Self>>[src]
pub fn is_partial(&self) -> bool[src]
impl<Input> StructuralPartialEq for Stream<Input> where
Input: StreamOnce + Positioned, [src]
Input: StreamOnce + Positioned,
Auto Trait Implementations
impl<Input> RefUnwindSafe for Stream<Input> where
Input: RefUnwindSafe,
<Input as StreamOnce>::Position: RefUnwindSafe,
<Input as StreamOnce>::Token: RefUnwindSafe, [src]
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, [src]
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, [src]
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, [src]
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, [src]
Input: UnwindSafe,
<Input as StreamOnce>::Position: UnwindSafe,
<Input as StreamOnce>::Token: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow(&self) -> &TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<Input> Stream for Input where
Input: StreamOnce + Positioned + ResetStream,
<Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>, [src]
Input: StreamOnce + Positioned + ResetStream,
<Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,