#text #binary #string

buf-trait

abstract over [u8], str, and friends

2 releases

0.4.1 Dec 27, 2023
0.4.0 Dec 26, 2023

#398 in #binary

Download history 4884/week @ 2025-09-19 5038/week @ 2025-09-26 4962/week @ 2025-10-03 5922/week @ 2025-10-10 6071/week @ 2025-10-17 5366/week @ 2025-10-24 5529/week @ 2025-10-31 4958/week @ 2025-11-07 5018/week @ 2025-11-14 5175/week @ 2025-11-21 5919/week @ 2025-11-28 6745/week @ 2025-12-05 6608/week @ 2025-12-12 6221/week @ 2025-12-19 6368/week @ 2025-12-26 7184/week @ 2026-01-02

27,514 downloads per month
Used in 81 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.

Dependencies

~1MB
~14K SLoC