Crates.io | smol_buf |
lib.rs | smol_buf |
version | 0.1.0 |
source | src |
created_at | 2024-05-12 11:27:57.558163 |
updated_at | 2024-05-12 11:27:57.558163 |
description | small-string optimized string / buffer type with O(1) clone |
homepage | |
repository | https://github.com/Swatinem/smol_buf |
max_upload_size | |
id | 1237380 |
size | 71,205 |
The smol_buf
crate offers the following types, each offering inline stack-allocated storage,
and falling back to heap-allocation otherwise.
ty | Deref Target | size_of::<T> |
size_of::<Option<T>> |
inline bytes | Clone |
---|---|---|---|---|---|
Str24 |
&str |
24 | 24 | 23 | O(1) |
Str16 |
&str |
16 | 16 | 15 | O(1) |
Buf24 |
&[u8] |
24 | 24 | 23 | O(1) |
Buf16 |
&[u8] |
16 | 16 | 15 | O(1) |
Unlike String
and Vec
, however, the types are immutable.
They are thus replacements for Arc<str>
and Arc<[u8]>
respectively.
Minimal Supported Rust Version: latest stable.
Bumping MSRV is not considered a semver-breaking change.