pub enum MixedRef<'a, T: ?Sized + 'a> {
Owned(Box<T>),
Borrowed(&'a T),
}
Expand description
A reference to either owned or borrowed data.
If the data is owned, it’s recommended to provide the 'static
lifetime.
In some cases, there’s no other option.
If mutably borrowing data, use MixedRefMut
.
Variants§
Trait Implementations§
Source§impl<'a, T: ?Sized> From<MixedRefMut<'a, T>> for MixedRef<'a, T>
impl<'a, T: ?Sized> From<MixedRefMut<'a, T>> for MixedRef<'a, T>
Source§fn from(r: MixedRefMut<'a, T>) -> Self
fn from(r: MixedRefMut<'a, T>) -> Self
Converts to this type from the input type.
impl<'a, T: Eq + ?Sized + 'a> Eq for MixedRef<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for MixedRef<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for MixedRef<'a, T>where
T: RefUnwindSafe + ?Sized,
impl<'a, T> Send for MixedRef<'a, T>
impl<'a, T> Sync for MixedRef<'a, T>
impl<'a, T> Unpin for MixedRef<'a, T>where
T: ?Sized,
impl<'a, T> UnwindSafe for MixedRef<'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