mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-11 00:00:23 +02:00
933b8b26f68c56102dd1f647d2dfb5add51e7e3a
BytesMut::reserve should avoid small allocations
This change tracks the original capacity requested when `BytesMut` is first created. This capacity is used when a `reserve` needs to allocate due to the current view being too small. The newly allocated buffer will be sized the same as the original allocation.
Bytes
A utility library for working with bytes.
Usage
To use bytes, first add this to your Cargo.toml:
[dependencies]
bytes = "0.4"
Next, add this to your crate:
extern crate bytes;
use bytes::{Bytes, BytesMut, Buf, BufMut};
License
bytes is primarily distributed under the terms of both the MIT license and the
Apache License (Version 2.0), with portions covered by various BSD-like
licenses.
See LICENSE-APACHE, and LICENSE-MIT for details.
Languages
Rust
99.6%
Shell
0.4%