pub struct GcRef<'a, T: ?Sized + 'static> { /* private fields */ }Expand description
A wrapper type for an immutably borrowed value from a GcCell<T>.
Implementations§
Source§impl<'a, T: ?Sized> GcRef<'a, T>
impl<'a, T: ?Sized> GcRef<'a, T>
Sourcepub fn clone(orig: &GcRef<'a, T>) -> GcRef<'a, T>
pub fn clone(orig: &GcRef<'a, T>) -> GcRef<'a, T>
Copies a GcCellRef.
The GcCell is already immutably borrowed, so this cannot fail.
This is an associated function that needs to be used as
GcCellRef::clone(...). A Clone implementation or a method
would interfere with the use of c.borrow().clone() to clone
the contents of a GcCell.
Sourcepub fn try_map<U, F>(orig: Self, f: F) -> Option<GcRef<'a, U>>
pub fn try_map<U, F>(orig: Self, f: F) -> Option<GcRef<'a, U>>
Tries to make a new GcCellRef from a component of the borrowed data, returning None
if the mapping function returns None.
The GcCell is already immutably borrowed, so this cannot fail.
This is an associated function that needs to be used as GcCellRef::try_map(...).
A method would interfere with methods of the same name on the contents
of a GcCellRef used through Deref.
Sourcepub fn map<U, F>(orig: Self, f: F) -> GcRef<'a, U>
pub fn map<U, F>(orig: Self, f: F) -> GcRef<'a, U>
Makes a new GcCellRef from a component of the borrowed data.
The GcCell is already immutably borrowed, so this cannot fail.
This is an associated function that needs to be used as GcCellRef::map(...).
A method would interfere with methods of the same name on the contents
of a GcCellRef used through Deref.
Sourcepub fn map_split<U, V, F>(orig: Self, f: F) -> (GcRef<'a, U>, GcRef<'a, V>)
pub fn map_split<U, V, F>(orig: Self, f: F) -> (GcRef<'a, U>, GcRef<'a, V>)
Splits a GcCellRef into multiple GcCellRefs for different components of the borrowed data.
The GcCell is already immutably borrowed, so this cannot fail.
This is an associated function that needs to be used as GcCellRef::map_split(...).
A method would interfere with methods of the same name on the contents of a GcCellRef used through Deref.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for GcRef<'a, T>
impl<'a, T> !Send for GcRef<'a, T>
impl<'a, T> !Sync for GcRef<'a, T>
impl<'a, T> !UnwindSafe for GcRef<'a, T>
impl<'a, T> Freeze for GcRef<'a, T>
impl<'a, T> Unpin for GcRef<'a, T>
impl<'a, T> UnsafeUnpin for GcRef<'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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more