Crates.io | lean_string |
lib.rs | lean_string |
version | |
source | src |
created_at | 2024-12-08 12:45:34.789232 |
updated_at | 2024-12-08 12:45:34.789232 |
description | Compact, clone-on-write string. |
homepage | |
repository | https://github.com/ryota2357/lean_string |
max_upload_size | |
id | 1476262 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
⚠️This is a work in progress.
Compact, clone-on-write string.
LeanString
has the following properties:
size_of::<LeanString>() == size_of::<[usize; 2]>()
(2 words).
usize
smaller than String
.LeanString
uses a reference-counted heap buffer (like Arc
).LeanString
is cloned, the heap buffer is shared.LeanString
is mutated, the heap buffer is copied if it is shared.O(1)
, zero allocation construction from &'static str
.Option<LeanString>
.
size_of::<Option<LeanString>>() == size_of::<LeanString>()
String
.String
.// TODO
TODO: Compare LeanString
with String
, EcoString
, CompactString
, etc...
The idea and implementation of LeanString
is inspired by the following projects:
I would like to thank the authors of these projects for their great work.
This crate is licensed under the MIT license.