pub struct Borrowed<'b, B: ?Sized>(pub &'b B);
Expand description
A StaticCow
implementation which wraps an immutable reference.
Tuple Fields§
§0: &'b B
Trait Implementations§
Source§impl<'b, B> IntoOwning for Borrowed<'b, B>
impl<'b, B> IntoOwning for Borrowed<'b, B>
Source§fn into_owning(self) -> Self::Owning
fn into_owning(self) -> Self::Owning
Converts an object which owns its contents into one which borrows them.
Source§impl<'b, B: Ord + ?Sized> Ord for Borrowed<'b, B>
impl<'b, B: Ord + ?Sized> Ord for Borrowed<'b, B>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'b, B: PartialOrd + ?Sized> PartialOrd for Borrowed<'b, B>
impl<'b, B: PartialOrd + ?Sized> PartialOrd for Borrowed<'b, B>
Source§impl<'b, B> StaticCow<B> for Borrowed<'b, B>
impl<'b, B> StaticCow<B> for Borrowed<'b, B>
Source§fn is_owned(&self) -> bool
fn is_owned(&self) -> bool
Returns true iff the data is owned, i.e. if
self.into_owning()
would
be a no-op.Source§fn mut_if_owned(&mut self) -> MutIfOwned<'_, <Self as Deref>::Target>
fn mut_if_owned(&mut self) -> MutIfOwned<'_, <Self as Deref>::Target>
Returns either an immutable reference to an object that is borrowed, or
a mutable reference to one which is owned. Read more
Source§fn into_cow<'a>(self) -> Cow<'a, B>where
Self: 'a,
Self::Owning: 'a,
fn into_cow<'a>(self) -> Cow<'a, B>where
Self: 'a,
Self::Owning: 'a,
Converts
self
into its dynamic equivalent as a Cow
.Source§fn into_owned(self) -> B::Owned
fn into_owned(self) -> B::Owned
Converts
self
into a B::Owned
, cloning only if necessary.Source§fn is_borrowed(&self) -> bool
fn is_borrowed(&self) -> bool
Returns true iff the data is borrowed, i.e. if
self.into_owning()
would clone it.impl<'b, B: Eq + ?Sized> Eq for Borrowed<'b, B>
impl<'b, B: ?Sized> StructuralPartialEq for Borrowed<'b, B>
Auto Trait Implementations§
impl<'b, B> Freeze for Borrowed<'b, B>where
B: ?Sized,
impl<'b, B> RefUnwindSafe for Borrowed<'b, B>where
B: RefUnwindSafe + ?Sized,
impl<'b, B> Send for Borrowed<'b, B>
impl<'b, B> Sync for Borrowed<'b, B>
impl<'b, B> Unpin for Borrowed<'b, B>where
B: ?Sized,
impl<'b, B> UnwindSafe for Borrowed<'b, B>where
B: RefUnwindSafe + ?Sized,
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