Struct RefMut

Source
pub struct RefMut<'b, T: ?Sized + 'b> { /* private fields */ }

Implementations§

Source§

impl<'b, T: ?Sized> RefMut<'b, T>

Source

pub fn map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> RefMut<'b, U>
where F: FnOnce(&mut T) -> &mut U,

Makes a new RefMut for a single component of the borrowed data, e.g., an enum variant.

This is an associated function that needs to be used as RefMut::map(...).

Source

pub fn split_tuple<U: ?Sized, V: ?Sized, F>( orig: RefMut<'b, T>, f: F, ) -> (RefMut<'b, U>, RefMut<'b, V>)
where F: FnOnce(&mut T) -> (&mut U, &mut V),

Splits a RefMut into a tuple of RefMuts for different components of the borrowed data.

Care must be taken to ensure that the resulting Shards refer to non-overlapping components of the parent RefMut.

The underlying RefCell will remain mutably borrowed until both returned RefMuts go out of scope.

This is an associated function that needs to be used a RefMut::split_tuple(...).

Source

pub fn split_triple<U: ?Sized, V: ?Sized, W: ?Sized, F>( orig: RefMut<'b, T>, f: F, ) -> (RefMut<'b, U>, RefMut<'b, V>, RefMut<'b, W>)
where F: FnOnce(&mut T) -> (&mut U, &mut V, &mut W),

Splits a RefMut into a triple of RefMuts for different components of the borrowed data.

Care must be taken to ensure that the resulting Shards refer to non-overlapping components of the parent RefMut.

The underlying RefCell will remain mutably borrowed until all three returned RefMuts go out of scope.

This is an associated function that needs to be used a RefMut::split_tuple(...).

Trait Implementations§

Source§

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

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

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

Source§

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

Mutably dereferences the value.
Source§

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

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'b, T> Freeze for RefMut<'b, T>
where T: ?Sized,

§

impl<'b, T> !RefUnwindSafe for RefMut<'b, T>

§

impl<'b, T> !Send for RefMut<'b, T>

§

impl<'b, T> !Sync for RefMut<'b, T>

§

impl<'b, T> Unpin for RefMut<'b, T>
where T: ?Sized,

§

impl<'b, T> !UnwindSafe for RefMut<'b, 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<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 = Infallible

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.