pub struct SharedCow<T: Clone>(/* private fields */);
Expand description
A container that transparently shares a value when possible, but clones on mutate.
Unlike Arc
, this is only intended to help save memory usage and reduce the amount of effort
required to clone unmodified values with easy to use copy-on-write.
This should more or less reflect the API of std::borrow::Cow
as much as is sensible.
Implementations§
Sourcepub fn into_owned(self: SharedCow<T>) -> T
pub fn into_owned(self: SharedCow<T>) -> T
Take an exclusive clone of the shared value, or move and take ownership if it wasn’t shared.
Trait Implementations§
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)