Trait combine::StreamOnce

source ·
pub trait StreamOnce {
    type Item: Clone + PartialEq;
    type Range: Clone + PartialEq;
    type Position: Clone + Ord;
    type Error: ParseError<Self::Item, Self::Range, Self::Position>;

    // Required method
    fn uncons(&mut self) -> Result<Self::Item, 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§

source

type Item: Clone + PartialEq

The type of items which is yielded from this stream.

source

type Range: Clone + PartialEq

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::Item for this type.

source

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.

source

type Error: ParseError<Self::Item, Self::Range, Self::Position>

Required Methods§

source

fn uncons(&mut self) -> Result<Self::Item, StreamErrorFor<Self>>

Takes a stream and removes its first item, yielding the item and the rest of the elements. Returns Err if no element could be retrieved.

Provided Methods§

source

fn is_partial(&self) -> bool

Returns true if this stream only contains partial input.

See PartialStream.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a> StreamOnce for &'a str

source§

impl<'a, T> StreamOnce for &'a [T]where T: Clone + PartialEq,

§

type Item = T

§

type Range = &'a [T]

§

type Position = PointerOffset

§

type Error = UnexpectedParse

source§

fn uncons(&mut self) -> Result<T, StreamErrorFor<Self>>

Implementors§

source§

impl<'a, T> StreamOnce for SliceStream<'a, T>where T: PartialEq + 'a,

source§

impl<I> StreamOnce for BufferedStream<I>where I: StreamOnce + Positioned, I::Item: Clone + PartialEq,

§

type Item = <I as StreamOnce>::Item

§

type Range = <I as StreamOnce>::Range

§

type Position = <I as StreamOnce>::Position

§

type Error = <I as StreamOnce>::Error

source§

impl<I, X, S> StreamOnce for State<I, X>where I: StreamOnce, X: Positioner<I::Item>, S: StreamError<I::Item, I::Range>, I::Error: ParseError<I::Item, I::Range, X::Position, StreamError = S> + ParseError<I::Item, I::Range, I::Position, StreamError = S>,

§

type Item = <I as StreamOnce>::Item

§

type Range = <I as StreamOnce>::Range

§

type Position = <X as Positioner<<I as StreamOnce>::Item>>::Position

§

type Error = <I as StreamOnce>::Error

source§

impl<I: Iterator> StreamOnce for IteratorStream<I>where I::Item: Clone + PartialEq,

§

type Item = <I as Iterator>::Item

§

type Range = <I as Iterator>::Item

§

type Position = ()

§

type Error = UnexpectedParse

source§

impl<R: Read> StreamOnce for ReadStream<R>

§

type Item = u8

§

type Range = u8

§

type Position = usize

§

type Error = Errors<u8, u8, usize>

source§

impl<S> StreamOnce for Stream<S>where S: StreamOnce + Positioned,

§

type Item = <S as StreamOnce>::Item

§

type Range = <S as StreamOnce>::Range

§

type Position = <S as StreamOnce>::Position

§

type Error = Errors<<S as StreamOnce>::Item, <S as StreamOnce>::Range, <S as StreamOnce>::Position>

source§

impl<S> StreamOnce for PartialStream<S>where S: StreamOnce,

§

type Item = <S as StreamOnce>::Item

§

type Range = <S as StreamOnce>::Range

§

type Position = <S as StreamOnce>::Position

§

type Error = <S as StreamOnce>::Error