[][src]Type Definition swim_mem::lease::HardString

type HardString<'a, M = ()> = Hard<'a, String<M>>;

Undereferenceable strong owner of a resizeable Unicode string stored in a Hold-allocated, atomically reference counted memory block.

Examples

Copy a string literal into a HardString allocated in the global hold:

let s = HardString::from_copy("Hello");

Obtain a mutably dereferenceable MutString lease from a HardString, copying its contents into a new, uniquely referenced string if and only if the old string is aliased, and concatenate it with another str using the + operator:

let s = HardString::from_copy("Hello");
let message = s.to_unique() + " world";