tokio-rs / bytes

Utilities for working with bytes
MIT License
1.87k stars 278 forks source link

Add support for the nightly unstable allocator API #656

Closed dylanplecki closed 8 months ago

dylanplecki commented 8 months ago

Fixes #653.

Adds a new, optional feature to the bytes crate to enable support for the Rust nightly unstable allocator_api feature (docs).

This feature is disabled by default and will only work on Rust nightly for now.

When enabled, this feature changes the default implementations of Buf and BufMut on Box<u8>, Vec<u8>, and VecDeque<u8> to support an optional second generic argument for an Allocator type. This Allocator controls how the type manages memory on the heap. No code paths are changed in the crate, only a new generic argument is provided to these types.

When disabled, this feature incurs no changes to the crate and does not change the API or any code paths.

dylanplecki commented 8 months ago

Closing due to the use of the unstable Rust feature allocator_api, see #653. This PR can be reattempted upon stabilization of the feature.