pub enum RefOrMut<'a, T>where
T: 'a,{
Ref(&'a T),
Mut(&'a mut T),
}
Expand description
Either an immutable or mutable reference.
Variants§
Implementations§
Source§impl<'a, T: Clone + 'a> RefOrMut<'a, T>
impl<'a, T: Clone + 'a> RefOrMut<'a, T>
Sourcepub fn swap<'b>(self, element: &'b mut T)
pub fn swap<'b>(self, element: &'b mut T)
Extracts the contents of self
, either by cloning or swapping.
This consumes self
because its contents are now in an unknown state.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for RefOrMut<'a, T>
impl<'a, T> RefUnwindSafe for RefOrMut<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for RefOrMut<'a, T>
impl<'a, T> Sync for RefOrMut<'a, T>where
T: Sync,
impl<'a, T> Unpin for RefOrMut<'a, T>
impl<'a, T> !UnwindSafe for RefOrMut<'a, 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