A String
with shared ownership.
Helpfull for some types that need to be parsed from a string
and get split into smaller parts like an Url
or a Vec
containing lines
which need to be owned by the parent type.
Note
First try to store references, for example &str
which is more efficient.
At the moment if you create a SharedString
the underlying bytes cannot be
mutated anymore.
Example
use SharedString;
// or SharedSyncString if `Sync` is required
let name = new.unwrap;
assert_eq!;
assert_eq!;
assert_eq!;
Performance
SharedString
can increase the perfomance in situations such as the example
above by over 30%. See benches/*
for benchmarks.