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 GcCellRef
s 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
.