#string #byte-buffer #binary #text

buf-trait

abstract over [u8], str, and friends

2 releases

0.4.1 Dec 27, 2023
0.4.0 Dec 26, 2023

#2600 in Algorithms

Download history 13/week @ 2024-07-29 11/week @ 2024-08-05 5/week @ 2024-08-12 7/week @ 2024-08-19 46/week @ 2024-08-26 12/week @ 2024-09-02 15/week @ 2024-09-09 8/week @ 2024-09-16 23/week @ 2024-09-23 44/week @ 2024-09-30 18/week @ 2024-10-07 27/week @ 2024-10-14 5/week @ 2024-10-21 3/week @ 2024-10-28 24/week @ 2024-11-04

60 downloads per month
Used in 3 crates (2 directly)

Apache-2.0

9KB
101 lines

buf-trait

The Buf trait.

This crate provides a trait for abstracting over buffer-like types, such as str and [u8]. This is a much stronger property than, say, implementing AsRef<[u8]>. These are variable-length types that you might want to store as a raw byte buffer and then transmute to and from &[u8].

This crate provides all the functionality necessary for doing so safely, correctly, and in const.


lib.rs:

The Buf trait.

This crate provides a trait for abstracting over buffer-like types, such as str and [u8]. This is a much stronger property than, say, implementing AsRef<[u8]>. These are variable-length types that you might want to store as a raw byte buffer and then transmute to and from &[u8].

This crate provides all the functionality necessary for doing so safely, correctly, and in const.

Dependencies

~0.6–1MB
~12K SLoC