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

type PtrString<'a, M = ()> = Ptr<'a, String<M>>;

Exclusive reference to a resizeable Unicode string stored in a Hold-allocated memory block, with string length and capacity metadata stored inside the allocation.

Storing string metadata in the memory block keeps the pointer structure exactly the size of a thin pointer.

Examples

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

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

Concatenate a PtrString with another str using the + operator:

let s = PtrString::from_copy("Hello");
let message = s + " world";