[][src]Struct combine::stream::position::Stream

pub struct Stream<Input, X> {
    pub input: Input,
    pub positioner: X,
}

The Stream<Input> struct maintains the current position in the stream Input using the Positioner trait to track the position.

    let result = token(b'9')
        .message("Not a nine")
        .easy_parse(position::Stream::new(&b"8"[..]));
    assert_eq!(result, Err(easy::Errors {
        position: 0,
        errors: vec![
            easy::Error::Unexpected(b'8'.into()),
            easy::Error::Expected(b'9'.into()),
            easy::Error::Message("Not a nine".into())
        ]
    }));

Fields

input: Input

The input stream used when items are requested

positioner: X

The positioner used to update the current position

Implementations

impl<Input, X> Stream<Input, X> where
    Input: StreamOnce,
    X: Positioner<Input::Token>, 
[src]

pub fn with_positioner(input: Input, positioner: X) -> Stream<Input, X>[src]

Creates a new Stream<Input, X> from an input stream and a positioner.

impl<Input> Stream<Input, Input::Positioner> where
    Input: StreamOnce + DefaultPositioned,
    Input::Positioner: Positioner<Input::Token>, 
[src]

pub fn new(input: Input) -> Stream<Input, Input::Positioner>[src]

Creates a new Stream<Input, X> from an input stream and its default positioner.

Trait Implementations

impl<Input: Clone, X: Clone> Clone for Stream<Input, X>[src]

impl<Input: Debug, X: Debug> Debug for Stream<Input, X>[src]

impl<Input: PartialEq, X: PartialEq> PartialEq<Stream<Input, X>> for Stream<Input, X>[src]

impl<Input, X, E> Positioned for Stream<Input, X> where
    Input: StreamOnce,
    X: Positioner<Input::Token>,
    E: StreamError<Input::Token, Input::Range>,
    Input::Error: ParseError<Input::Token, Input::Range, X::Position, StreamError = E>,
    Input::Error: ParseError<Input::Token, Input::Range, Input::Position, StreamError = E>, 
[src]

impl<Input, X, S> RangeStreamOnce for Stream<Input, X> where
    Input: RangeStreamOnce,
    X: RangePositioner<Input::Token, Input::Range>,
    S: StreamError<Input::Token, Input::Range>,
    Input::Error: ParseError<Input::Token, Input::Range, X::Position, StreamError = S>,
    Input::Error: ParseError<Input::Token, Input::Range, Input::Position, StreamError = S>,
    Input::Position: Clone + Ord
[src]

impl<Input, X, S> ResetStream for Stream<Input, X> where
    Input: ResetStream,
    X: Positioner<Input::Token>,
    S: StreamError<Input::Token, Input::Range>,
    Input::Error: ParseError<Input::Token, Input::Range, X::Position, StreamError = S>,
    Input::Error: ParseError<Input::Token, Input::Range, Input::Position, StreamError = S>, 
[src]

type Checkpoint = Stream<Input::Checkpoint, X::Checkpoint>

impl<Input, X, S> StreamOnce for 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>, 
[src]

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 = X::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

impl<Input, X> StructuralPartialEq for Stream<Input, X>[src]

Auto Trait Implementations

impl<Input, X> RefUnwindSafe for Stream<Input, X> where
    Input: RefUnwindSafe,
    X: RefUnwindSafe

impl<Input, X> Send for Stream<Input, X> where
    Input: Send,
    X: Send

impl<Input, X> Sync for Stream<Input, X> where
    Input: Sync,
    X: Sync

impl<Input, X> Unpin for Stream<Input, X> where
    Input: Unpin,
    X: Unpin

impl<Input, X> UnwindSafe for Stream<Input, X> where
    Input: UnwindSafe,
    X: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<Input> RangeStream for Input where
    Input: RangeStreamOnce + Stream
[src]

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]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.