Module async_peek_reader

Module async_peek_reader 

Source
Expand description

This module implements a buffered/peekable reader using async I/O.

The purpose of the buffered/peekable reader is to allow for backtracking parsers.

This is the async version of crate::peek_reader::PeekReader. A reader implementing the tokio library’s [tokio::io::AsyncBufRead]/[tokio::io::AsyncBufReadExt] traits seems like a good fit, but it does not allow for peeking a specific number of bytes, so it provides no way to request more data from the underlying reader without consuming the existing data.

This API still tries to adhere to the [tokio::io::AsyncBufRead]’s trait philosophy.

The main type AsyncPeekReader does not implement [tokio::io::AsyncBufReadExt] itself, as there is no added benefit in doing so.

Structs§

AsyncPeekReader
A buffered/peekable reader