Expand description
Streams are similar to the Iterator
trait in that they represent some sequential set of items
which can be retrieved one by one. Where Stream
s differ is that they are allowed to return
errors instead of just None
and if they implement the RangeStreamOnce
trait they are also
capable of returning multiple items at the same time, usually in the form of a slice.
In addition to he functionality above, a proper Stream
usable by a Parser
must also have a
position (marked by the Positioned
trait) and must also be resetable (marked by the
ResetStream
trait). The former is used to ensure that errors at different points in the stream
aren’t combined and the latter is used in parsers such as or
to try multiple alternative
parses.
Re-exports§
pub use self::decoder::Decoder;
Modules§
- buf_
reader - buffered
- Stream wrapper which provides a
ResetStream
impl forStreamOnce
impls which do not have one. - decoder
- easy
- Stream wrapper which provides an informative and easy to use error type.
- position
- Stream wrapper which provides more detailed position information.
- read
- Stream wrapper allowing
std::io::Read
to be used - span
- state
- Stream wrapper allowing custom state to be used.
Structs§
- Complete
Stream - Stream type which indicates that the stream is complete if end of input is reached
- Iterator
Stream - Wrapper around iterators which allows them to be treated as a stream.
Returned by
IteratorStream::new
. - Maybe
Partial Stream - Partial
Stream - Stream type which indicates that the stream is partial if end of input is reached
- Pointer
Offset - Newtype around a pointer offset into a slice stream (
&[T]
/&str
). - Slice
Stream - Newtype for constructing a stream from a slice where the items in the slice are not copyable.
Traits§
- Positioned
- A type which has a position.
- Range
- Trait representing a range of elements.
- Range
Stream - A
RangeStream
is an extension ofStream
which allows for zero copy parsing. - Range
Stream Once - A
RangeStream
is an extension ofStreamOnce
which allows for zero copy parsing. - Reset
Stream - A
StreamOnce
which can create checkpoints which the stream can be reset to - Stream
- A stream of tokens which can be duplicated
- Stream
Once StreamOnce
represents a sequence of items that can be extracted one by one.
Functions§
- decode
- Decodes
input
usingparser
. - decode_
tokio - Decodes
input
usingparser
. Likedecode
but works directly in bothtokio_util::Decoder::decode
andtokio_util::Decoder::decode_eof
- uncons
- uncons_
range - uncons_
while - Removes items from the input while
predicate
returnstrue
. - uncons_
while1 - Takes items from stream, testing each one with
predicate
returns a range of at least one items which passedpredicate
.
Type Aliases§
- Stream
Error For - Convenience alias over the
StreamError
for the input streamInput