Enum own::OwnedOrMutRef
source · pub enum OwnedOrMutRef<'r, T> {
Owned(T),
MutRef(&'r mut T),
}
Expand description
Holds an owned T
or a mutable reference.
Variants§
Implementations§
source§impl<'r, T> OwnedOrMutRef<'r, T>
impl<'r, T> OwnedOrMutRef<'r, T>
sourcepub fn reborrow(&mut self) -> OwnedOrMutRef<'_, T>
pub fn reborrow(&mut self) -> OwnedOrMutRef<'_, T>
Reborrows this OwnedOrMutRef
with a shorter lifetime.
For an Owned
variant, this borrows it as a MutRef
.
Trait Implementations§
source§impl<'r, T: Debug> Debug for OwnedOrMutRef<'r, T>
impl<'r, T: Debug> Debug for OwnedOrMutRef<'r, T>
source§impl<'r, T> Deref for OwnedOrMutRef<'r, T>
impl<'r, T> Deref for OwnedOrMutRef<'r, T>
source§impl<'r, T> DerefMut for OwnedOrMutRef<'r, T>
impl<'r, T> DerefMut for OwnedOrMutRef<'r, T>
source§impl<'r, T> From<&'r mut T> for OwnedOrMutRef<'r, T>
impl<'r, T> From<&'r mut T> for OwnedOrMutRef<'r, T>
source§impl<'r, T> From<T> for OwnedOrMutRef<'r, T>
impl<'r, T> From<T> for OwnedOrMutRef<'r, T>
source§impl<'r, T: PartialEq> PartialEq for OwnedOrMutRef<'r, T>
impl<'r, T: PartialEq> PartialEq for OwnedOrMutRef<'r, T>
source§fn eq(&self, other: &OwnedOrMutRef<'r, T>) -> bool
fn eq(&self, other: &OwnedOrMutRef<'r, T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<'r, T: Eq> Eq for OwnedOrMutRef<'r, T>
impl<'r, T> StructuralPartialEq for OwnedOrMutRef<'r, T>
Auto Trait Implementations§
impl<'r, T> Freeze for OwnedOrMutRef<'r, T>where
T: Freeze,
impl<'r, T> RefUnwindSafe for OwnedOrMutRef<'r, T>where
T: RefUnwindSafe,
impl<'r, T> Send for OwnedOrMutRef<'r, T>where
T: Send,
impl<'r, T> Sync for OwnedOrMutRef<'r, T>where
T: Sync,
impl<'r, T> Unpin for OwnedOrMutRef<'r, T>where
T: Unpin,
impl<'r, T> !UnwindSafe for OwnedOrMutRef<'r, 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