Skip to main content

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’s cheaply cloneable, there are a number of use cases where MetaString isn’t 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 isn’t cheaply cloneable, None is returned.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl CheapMetaString for &str

Source§

impl CheapMetaString for String

Source§

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

Implementors§