Skip to main content

GcRefMut

Struct GcRefMut 

Source
pub struct GcRefMut<'a, T: ?Sized> { /* private fields */ }
Expand description

A wrapper type for a mutably borrowed value from a GcCell<T>.

Implementations§

Source§

impl<'a, T: ?Sized> GcRefMut<'a, T>

Source

pub unsafe fn cast<V>(orig: Self) -> GcRefMut<'a, V>

Casts to a GcRefMut of another type.

§Safety
  • The caller must ensure that U can be safely cast to V.
Source

pub fn try_map<V, F>(orig: GcRefMut<'a, T>, f: F) -> Option<GcRefMut<'a, V>>
where V: ?Sized, F: FnOnce(&mut T) -> Option<&mut V>,

Tries to make a new GcCellRefMut for a component of the borrowed data, returning None if the mapping function returns None.

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.

Source

pub fn map<V, F>(orig: Self, f: F) -> GcRefMut<'a, V>
where V: ?Sized, F: FnOnce(&mut T) -> &mut V,

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.

Trait Implementations§

Source§

impl<T: Debug + ?Sized> Debug for GcRefMut<'_, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: ?Sized> Deref for GcRefMut<'_, T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<T: ?Sized> DerefMut for GcRefMut<'_, T>

Source§

fn deref_mut(&mut self) -> &mut T

Mutably dereferences the value.
Source§

impl<T: Display + ?Sized> Display for GcRefMut<'_, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, T> !RefUnwindSafe for GcRefMut<'a, T>

§

impl<'a, T> !Send for GcRefMut<'a, T>

§

impl<'a, T> !Sync for GcRefMut<'a, T>

§

impl<'a, T> !UnwindSafe for GcRefMut<'a, T>

§

impl<'a, T> Freeze for GcRefMut<'a, T>

§

impl<'a, T> Unpin for GcRefMut<'a, T>

§

impl<'a, T> UnsafeUnpin for GcRefMut<'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.