pub struct Stream<R> { /* private fields */ }
Implementations
sourceimpl<R> Stream<R> where
R: Read,
impl<R> Stream<R> where
R: Read,
sourcepub fn new(read: R) -> Stream<R>
pub fn new(read: R) -> Stream<R>
Creates a StreamOnce
instance from a value implementing std::io::Read
.
NOTE: This type do not implement Positioned
and Clone
and must be wrapped with types
such as BufferedStreamRef
and State
to become a Stream
which can be parsed
use combine::*;
use combine::parser::byte::*;
use combine::stream::read;
use combine::stream::buffered;
use combine::stream::position;
use std::io::Read;
let input: &[u8] = b"123,";
let stream = buffered::Stream::new(position::Stream::new(read::Stream::new(input)), 1);
let result = (many(digit()), byte(b','))
.parse(stream)
.map(|t| t.0);
assert_eq!(result, Ok((vec![b'1', b'2', b'3'], b',')));
Trait Implementations
sourceimpl<R> DefaultPositioned for Stream<R>
impl<R> DefaultPositioned for Stream<R>
type Positioner = IndexPositioner
sourceimpl<R: Read> StreamOnce for Stream<R>
impl<R: Read> StreamOnce for Stream<R>
type Range = &'static [u8]
type Range = &'static [u8]
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 = usize
type Position = usize
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 = Error
sourcefn uncons(&mut self) -> Result<u8, StreamErrorFor<Self>>
fn uncons(&mut self) -> Result<u8, StreamErrorFor<Self>>
Takes a stream and removes its first token, yielding the token and the rest of the elements.
Returns Err
if no element could be retrieved. Read more
sourcefn is_partial(&self) -> bool
fn is_partial(&self) -> bool
Returns true
if this stream only contains partial input. Read more
Auto Trait Implementations
impl<R> RefUnwindSafe for Stream<R> where
R: RefUnwindSafe,
impl<R> Send for Stream<R> where
R: Send,
impl<R> Sync for Stream<R> where
R: Sync,
impl<R> Unpin for Stream<R> where
R: Unpin,
impl<R> UnwindSafe for Stream<R> where
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more