Skip to main content

ArcColdString

Type Alias ArcColdString 

Source
pub type ArcColdString = ArcColdStringInner<AtomicUsize>;
Expand description

A one-word, atomically reference-counted immutable UTF-8 string.

Strings up to one machine word are stored inline. Longer strings use one allocation containing the reference count, variable-length length, and bytes. If the reference count saturates, the allocation becomes immortal (and is never deallocated) rather than allowing the count to wrap.

use cold_string::ArcColdString;

let first = ArcColdString::new("a string longer than one machine word");
let second = first.clone();
assert_eq!(first, second);

Aliased Typeยง

pub struct ArcColdString { /* private fields */ }