#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

#2501 in Algorithms

Download history 19/week @ 2024-06-02 13/week @ 2024-06-09 13/week @ 2024-06-16 13/week @ 2024-06-23 2/week @ 2024-06-30 8/week @ 2024-07-07 16/week @ 2024-07-14 2/week @ 2024-07-21 12/week @ 2024-07-28 11/week @ 2024-08-04 6/week @ 2024-08-11 6/week @ 2024-08-18 34/week @ 2024-08-25 23/week @ 2024-09-01 16/week @ 2024-09-08 7/week @ 2024-09-15

81 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–0.9MB
~12K SLoC