Enum smartcow::SmartCow [−][src]
pub enum SmartCow<'a> { Borrowed(&'a str), Owned(SmartString<LazyCompact>), }
Expand description
The primary type for this crate, which holds either a borrowed str
or a SmartString
Variants
a std::str
borrow
Tuple Fields of Borrowed
0: &'a str
Tuple Fields of Owned
Implementations
Build a ’static duplicate of this SmartCow by cloning a
reference. If you own the SmartCow, SmartCow::into_owned
is preferable, as it will not allocate an unnecesssary owned
value.
This is identical to calling self.clone().into_owned()
,
which first allocates in the case of an owned variant by
cloning, and then allocates in the case of a borrowed variant,
with into_owned.
Build a ’static duplicate of this SmartCow by value, by
allocating a SmartString if self is a SmartCow::Borrowed
variant. If you do not have ownership of a SmartCow and need
to create a ’static SmartCow from it by reference, use
SmartCow::to_owned
Trait Implementations
Performs the conversion.
Auto Trait Implementations
impl<'a> RefUnwindSafe for SmartCow<'a>
impl<'a> UnwindSafe for SmartCow<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more