Type | Crate | Mutable | Clone | Hash | Size1 | SSO |
---|---|---|---|---|---|---|
String |
std | Yes | O(n) | O(n) | 24 bytes | No |
Box<str> |
std | No | O(n) | O(n) | 16 bytes + niche | No |
Arc<str> |
std | No | O(1) | O(n) | 16 bytes + niche | No |
FastStr |
faststr | No | O(1) | O(n) | 40 bytes + niche | 24 bytes2 |
CompactString |
compact_str | Yes | O(n) | O(n) | 24 bytes + niche | 23 bytes |
SmolStr |
smol_str | No | O(1) | O(n) | 24 bytes + niche | 22 bytes/WS3 |
Yarn |
byteyarn | No | O(1) | O(n) | 16 bytes + niche | 15 bytes |
ArcStr |
arcstr | No | O(1) | O(n) | 8 bytes + niche | No |
UStr |
ustr | No | O(1) | O(1) | 8 bytes + niche | No |
EcoString |
ecow | Yes | O(1)4 | O(n) | 16 bytes | 15 bytes |
Type | Crate | From String |
From Box<str> |
From Arc<str> |
From &'static str |
---|---|---|---|---|---|
String |
std | - | O(1) | No | O(n) |
Box<str> |
std | O(n) | - | No | O(n) |
Arc<str> |
std | O(n) | O(n) | - | O(n) |
FastStr |
faststr | O(n) | O(n) | O(1) | O(1) |
CompactString |
compact_str | O(1) | O(1) | No | O(1) |
SmolStr |
smol_str | O(n) | O(n) | O(1) | O(1) |
Yarn |
byteyarn | O(n) | O(1) | No | O(1) |
ArcStr |
arcstr | O(n) | O(n) | O(n) | O(1)5 |
UStr |
ustr | O(n) | No | No | O(n) |
EcoString |
ecow | O(n) | No | No | O(n) |
Type | Crate | no-std | MSRV | serde | bytes | rkyv |
---|---|---|---|---|---|---|
FastStr |
faststr | No | 1.60 | Yes | Yes | No |
CompactString |
compact_str | Yes | 1.60 | Yes | Yes | Yes |
SmolStr |
smol_str | Yes | 1.60 | Yes | No | No |
Yarn |
byteyarn | No | 1.71 | No | No | No |
ArcStr |
arcstr | Yes | 1.57 | Yes | No | No |
UStr |
ustr | No | 1.60 | Yes | No | No |
EcoString |
ecow | Yes | 1.65 | Yes | No | No |
Type | Crate | Unsafe | Dependencies6 | License |
---|---|---|---|---|
FastStr |
faststr | UTF-87 | 2 | MIT/Apache |
CompactString |
compact_str | Yes | 6 | MIT |
SmolStr |
smol_str | Yes | 0 | MIT/Apache |
Yarn |
byteyarn | Yes | 1 | Apache 2.0 |
ArcStr |
arcstr | Yes | 0 | Apache-2.0 OR MIT OR Zlib |
UStr |
ustr | Yes | 4 | BSD-2-Clause-Patent |
EcoString |
ecow | Yes | 0 | MIT/Apache |