Crate compact_strings

source ·
Expand description

Implements a cache-friendly but limited representation of a list of strings.

Strings are stored contiguously in a vector of bytes, with their lengths and starting indices being stored separately.

Limitations include being unable to mutate strings stored in the vector.

Examples

let mut cmpstrs = CompactStrings::with_capacity(10);

cmpstrs.push("One".to_string());
cmpstrs.push("Two".to_string());
cmpstrs.push("Three".to_string());

cmpstrs.remove(1);

assert_eq!(cmpstrs.get(0), Some("One"));
assert_eq!(cmpstrs.get(1), Some("Three"));
assert_eq!(cmpstrs.get(2), None);

Structs