[−][src]Struct gc::GcCellRefMut
A wrapper type for a mutably borrowed value from a GcCell<T>
.
Implementations
impl<'a, T: Trace + ?Sized> GcCellRefMut<'a, T>
[src]
pub fn map<U: ?Sized, F>(orig: Self, f: F) -> GcCellRefMut<'a, U> where
U: Trace,
F: FnOnce(&mut T) -> &mut U,
[src]
U: Trace,
F: FnOnce(&mut T) -> &mut U,
Makes a new GcCellRefMut
for a component of the borrowed data, e.g., an enum
variant.
The GcCellRefMut
is already mutably borrowed, so this cannot fail.
This is an associated function that needs to be used as
GcCellRefMut::map(...)
. A method would interfere with methods of the same
name on the contents of a GcCell
used through Deref
.
Examples
use gc::{GcCell, GcCellRefMut}; let c = GcCell::new((5, 'b')); { let b1: GcCellRefMut<(u32, char)> = c.borrow_mut(); let mut b2: GcCellRefMut<u32> = GcCellRefMut::map(b1, |t| &mut t.0); assert_eq!(*b2, 5); *b2 = 42; } assert_eq!(*c.borrow(), (42, 'b'));
Trait Implementations
impl<'a, T: Trace + ?Sized + Debug> Debug for GcCellRefMut<'a, T>
[src]
impl<'a, T: Trace + ?Sized> Deref for GcCellRefMut<'a, T>
[src]
impl<'a, T: Trace + ?Sized> DerefMut for GcCellRefMut<'a, T>
[src]
impl<'a, T: Trace + ?Sized + Display> Display for GcCellRefMut<'a, T>
[src]
impl<'a, T: Trace + ?Sized> Drop for GcCellRefMut<'a, T>
[src]
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for GcCellRefMut<'a, T>
impl<'a, T> !Send for GcCellRefMut<'a, T>
impl<'a, T> !Sync for GcCellRefMut<'a, T>
impl<'a, T: ?Sized> Unpin for GcCellRefMut<'a, T>
impl<'a, T> !UnwindSafe for GcCellRefMut<'a, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,