Trait chomp::types::Buffer [] [src]

pub trait Buffer: PartialEq<Self> {
    type Token: Copy + PartialEq;
    fn fold<B, F>(self, _: B, _: F) -> B
    where
        F: FnMut(B, Self::Token) -> B
; fn iterate<F>(&self, _: F)
    where
        F: FnMut(Self::Token)
; fn len(&self) -> usize; fn to_vec(&self) -> Vec<Self::Token>; fn into_vec(self) -> Vec<Self::Token>; fn is_empty(&self) -> bool { ... } }

The buffers yielded parsers consuming a sequence of the input.

This could either be an owned type or a slice reference depending on the Input implementation.

Associated Types

The token type of this buffer.

Required Methods

Applies a function in order on all tokens present in the buffer carrying an accumulator value B between invocations. The buffer is consumed as part of the folding and the last value of the accumulator is returned.

Runs the supplied function on a borrow of each token present in the buffer. Invoked in order and once per token.

The number of tokens present in this buffer.

Copies all the tokens in this buffer to a new Vec.

Consumes self to create an owned vector of tokens.

Will allocate if the implementation borrows storage or does not use an owned type compatible with Vec internally.

Provided Methods

Returns true if this buffer is empty.

Implementors