Module combine::stream

source ·
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 Streams 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§

Modules§

  • Stream wrapper which provides a ResetStream impl for StreamOnce impls which do not have one.
  • easystd
    Stream wrapper which provides an informative and easy to use error type.
  • Stream wrapper which provides more detailed position information.
  • readstd
    Stream wrapper allowing std::io::Read to be used
  • Stream wrapper allowing custom state to be used.

Structs§

Traits§

  • A type which has a position.
  • Trait representing a range of elements.
  • A RangeStream is an extension of Stream which allows for zero copy parsing.
  • A RangeStream is an extension of StreamOnce which allows for zero copy parsing.
  • A StreamOnce which can create checkpoints which the stream can be reset to
  • A stream of tokens which can be duplicated
  • StreamOnce represents a sequence of items that can be extracted one by one.

Functions§

  • Decodes input using parser.
  • Decodes input using parser. Like decode but works directly in both tokio_util::Decoder::decode and tokio_util::Decoder::decode_eof
  • Removes items from the input while predicate returns true.
  • Takes items from stream, testing each one with predicate returns a range of at least one items which passed predicate.

Type Aliases§

  • Convenience alias over the StreamError for the input stream Input