pub struct CowBox<T> { /* private fields */ }Expand description
A copy-on-write smart pointer.
CowBox<T> wraps a value that is shared (read-only) until a mutation
is requested, at which point it copies the value to create a unique owner.
Implementations§
Source§impl<T: Clone> CowBox<T>
impl<T: Clone> CowBox<T>
Sourcepub fn was_copied(&self) -> bool
pub fn was_copied(&self) -> bool
Check if a COW copy has been made.
Sourcepub fn into_owned(self) -> T
pub fn into_owned(self) -> T
Unwrap the value, cloning if not unique.
Trait Implementations§
impl<T: Clone + Eq> Eq for CowBox<T>
Auto Trait Implementations§
impl<T> !Freeze for CowBox<T>
impl<T> !RefUnwindSafe for CowBox<T>
impl<T> !Send for CowBox<T>
impl<T> !Sync for CowBox<T>
impl<T> Unpin for CowBox<T>
impl<T> UnsafeUnpin for CowBox<T>
impl<T> !UnwindSafe for CowBox<T>
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