Crate fixed_buffer_tokio[][src]

Expand description version license: Apache 2.0 unsafe forbidden pipeline status

This is a Rust library with fixed-size buffers, useful for network protocol parsers and file parsers.

This is the tokio async version of fixed-buffer.


  • Write bytes to the buffer and read them back
  • Use it to read a stream, search for a delimiter, and save leftover bytes for the next read.
  • Does not allocate memory
  • Depends only on std, tokio, and fixed-buffer.
  • No macros
  • Good test coverage (98%)
  • forbid(unsafe_code)



For a complete example, see tests/



  • v0.3.2 - Update docs
  • v0.3.1 - Support Tokio 1
  • v0.3.0 - Breaking API changes:
    • Change type parameter to const buffer size. Example: FixedBuf<1024>.
    • Remove new arg.
    • Remove capacity.
    • Change writable return type to &mut [u8].
  • v0.1.1 - Add badges to readme
  • v0.1.0 - First published version

Release Process

  1. Edit Cargo.toml and bump version number.
  2. Run ../


A newtype that wraps FixedBuf and implements tokio::io::AsyncRead and tokio::io::AsyncWrite.

A wrapper for a pair of structs. The first implements AsyncRead. The second implements AsyncRead+AsyncWrite.

Wraps a struct that implements AsyncRead+AsyncWrite. Passes through reads and writes to the struct. Limits the number of bytes that can be read.