pub trait StringOptimizations {
// Required methods
fn as_cow(&self) -> CowStr<'_>;
fn to_shared(&self) -> SharedString;
}Expand description
Convert common string operations to use Cow to avoid clones
Required Methods§
Sourcefn as_cow(&self) -> CowStr<'_>
fn as_cow(&self) -> CowStr<'_>
Get a borrowed or owned string depending on whether modification is needed
Share a string across multiple owners without cloning