pub struct Lc<T>(/* private fields */);
Expand description
Lc is a LazyClone wrapper, to provide lazy cloning for any data that doesn’t implement LazyClone
trait
If you’re able to implement LazyClone for the data that you need, do it, if not, use this wrapper
Implementations§
Source§impl<T: Clone> Lc<T>
impl<T: Clone> Lc<T>
Sourcepub fn read_mut(&mut self) -> &mut T
pub fn read_mut(&mut self) -> &mut T
Ensures that the lazily cloned value is mutable and returns a mutable reference to it
Sourcepub fn write(&mut self, value: T)
pub fn write(&mut self, value: T)
Replaces the cloned value by another
Does not affect any value lazily cloned from this value
Sourcepub fn take(&self) -> T
pub fn take(&self) -> T
Does an actual clone of the contained value
This clone may be expensive
Trait Implementations§
Source§impl<T: Clone> BorrowMut<T> for Lc<T>
impl<T: Clone> BorrowMut<T> for Lc<T>
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: Clone> LazyClone for Lc<T>
impl<T: Clone> LazyClone for Lc<T>
Source§fn lazy(&self) -> Self
fn lazy(&self) -> Self
The O(1) lazy-clone method.
Useful for cloning data that doesn’t necessarily need to be mutated.
Source§fn eager(&self) -> Self
fn eager(&self) -> Self
A non-lazy cloning method. Useful for cloning data that is known to modified
Source§fn is_mutable(&self) -> bool
fn is_mutable(&self) -> bool
Checks if the structure can be mutated with no side effects
Auto Trait Implementations§
impl<T> Freeze for Lc<T>
impl<T> RefUnwindSafe for Lc<T>where
T: RefUnwindSafe,
impl<T> !Send for Lc<T>
impl<T> !Sync for Lc<T>
impl<T> Unpin for Lc<T>
impl<T> UnwindSafe for Lc<T>where
T: RefUnwindSafe,
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