char-list
A persistent string type with the same API as a linked-list of characters.
Docs
See the docs for memory-layout diagrams and explanations of how it all works.
DISCLAIMER: unsafe
This crate is a work in progress. Specifically Not all uses of unsafe have been validated! Please don't use this for anything serious yet.
Safety audits are welcome and appreciated! I'm still quite new to writing unsafe code.
Also, this crate depends on front-vec which is also badly in need of auditing.
Example
use assert; // For nicer assertions.
let icon = from;
let nomicon = icon.cons_str;
let rustonomicon = nomicon.cons_str;
let rustonomicon2 = rustonomicon.clone; // Cloning only copys two words.
assert!;
assert!;
assert!;
assert!;
// No new allocations required (if underlying buffer capacity allows).
// Mutably prepends the `&str` to the buffer without shifting memory.
let the_book = rustonomicon.cons_str;
assert!;
// Drop to mutably resize underlying buffer and
drop;
drop;
drop;
let janelle_monae = icon.cons; // Duplication required now.
assert!;