#byte #slice #zero-copy #reference-counting #storage #cloning #minibytes

sapling-minibytes

Shared reference-counted bytes and str with zero-copy slicing support

1 unstable release

0.1.0 Nov 11, 2024

#2241 in Rust patterns

Download history 112/week @ 2024-11-08 24/week @ 2024-11-15 13/week @ 2024-11-22 20/week @ 2024-11-29 17/week @ 2024-12-06

79 downloads per month
Used in 4 crates

MIT license

27KB
646 lines

minibytes

This create provides the Bytes type. It is similar to &[u8]: cloning or slicing are zero-copy. Unlike &[u8], Bytes does not have lifetime. This is done by maintaining the life cycle of the underlying storage using reference count.

Aside from supporting Vec<u8> as the underlying storage, Bytes also supports memmap2::Mmap. Libraries can implement BytesOwner for other types to further extend storage support.

Dependencies

~0.3–1MB
~22K SLoC