CheapMetaString

Trait CheapMetaString 

Source
pub trait CheapMetaString {
    // Required method
    fn try_cheap_clone(&self) -> Option<MetaString>;
}
Expand description

A string type that can be cheaply cloned into a MetaString.

While callers working directly with MetaString already have access to determine if it is cheaply cloneable, there are a number of use cases where MetaString is not directly accessible. This trait allows types wrapping MetaString to expose the ability to cheaply clone the inner MetaString when possible, without having to expose it directly.

Required Methods§

Source

fn try_cheap_clone(&self) -> Option<MetaString>

Attempts to cheaply clone the string.

If the string is not cheaply cloneable, None is returned.

Implementations on Foreign Types§

Source§

impl CheapMetaString for &str

Source§

impl CheapMetaString for String

Source§

impl<T> CheapMetaString for &T
where T: CheapMetaString,

Implementors§