Struct chomp::buffer::SliceStream
[−]
[src]
pub struct SliceStream<'i, I: 'i> { // some fields omitted }
Stream implementation for immutable slices.
use chomp::{token, take}; use chomp::buffer::{IntoStream, Stream}; let i = b"foo"; let r = i.into_stream().parse(parser!{ token(b'f'); take(2); }); assert_eq!(r, Ok(b"oo" as &[u8]));
use chomp::{token, many, take}; use chomp::buffer::{IntoStream, Stream}; let i = b"foofoo"; let r = i.into_stream().parse(parser!{many(parser!{ token(b'f'); take(2); })}); assert_eq!(r, Ok(vec![b"oo" as &[u8], b"oo" as &[u8]]));
Methods
impl<'i, I: 'i> SliceStream<'i, I>
[src]
fn new(slice: &'i [I]) -> Self
Creates a new stream from an immutable slice.
fn len(&self) -> usize
The number of bytes left in the buffer
fn is_empty(&self) -> bool
Returns true if no more bytes are available
Trait Implementations
impl<'i, I: Hash + 'i> Hash for SliceStream<'i, I>
[src]
fn hash<__HI: Hasher>(&self, __arg_0: &mut __HI)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl<'i, I: PartialEq + 'i> PartialEq for SliceStream<'i, I>
[src]
fn eq(&self, __arg_0: &SliceStream<'i, I>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &SliceStream<'i, I>) -> bool
This method tests for !=
.