[][src]Struct guard_trait::MappedMut

pub struct MappedMut<T, U> where
    T: GuardedMut,
    U: ?Sized
{ /* fields omitted */ }

A mapped guard, which contains a guarded owned pointer, and a mutable reference to that pointer. It has had a one-time closure applied to it, but only the output of the closure is stored, not the closure itself. This is similar to how crates like owning_ref work.

Implementations

impl<T, U> MappedMut<T, U> where
    T: GuardedMut,
    U: ?Sized
[src]

pub fn into_original(self) -> T[src]

Move out the original pointer from the mapped guard, hence cancelling the temporary borrow.

pub fn into_immutable(this: MappedMut<T, U>) -> Mapped<T, U>[src]

Convert MappedMut<T, U> to Mapped<T, U>.

pub fn get_ref(&self) -> &U[src]

Get an immutable reference to the mapped data.

pub fn get_mut(&mut self) -> &mut U[src]

Get a mutable reference to the mapped data.

pub fn and_then<F, V>(self, f: F) -> MappedMut<T, V> where
    F: FnOnce(&mut U) -> &mut V,
    V: ?Sized
[src]

Map the mapped reference again, converting &mut U to &mut V.

pub fn try_and_then<F, V, E>(self, f: F) -> Result<MappedMut<T, V>, E> where
    F: FnOnce(&mut U) -> Result<&mut V, E>,
    V: ?Sized
[src]

Attempt to map the reference again, but with the ability to short-circuit on errors.

Trait Implementations

impl<T, U> Guarded for MappedMut<T, U> where
    T: GuardedMut,
    U: ?Sized
[src]

type Target = U

The target pointee that this pointer may dereference into. There are no real restrictions to what this type can be. However, the user must not assume that simply because a &Target reference is protected, that references indirectly derived (via Deref and other traits) would also be protected. Read more

impl<T, U> GuardedMut for MappedMut<T, U> where
    T: GuardedMut,
    U: ?Sized
[src]

Auto Trait Implementations

impl<T, U: ?Sized> RefUnwindSafe for MappedMut<T, U> where
    T: RefUnwindSafe,
    U: RefUnwindSafe

impl<T, U> !Send for MappedMut<T, U>

impl<T, U> !Sync for MappedMut<T, U>

impl<T, U: ?Sized> Unpin for MappedMut<T, U> where
    T: Unpin

impl<T, U: ?Sized> UnwindSafe for MappedMut<T, U> where
    T: UnwindSafe,
    U: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Guarded for T where
    T: Deref<Target = U> + StableDeref + 'static,
    U: ?Sized
[src]

type Target = U

The target pointee that this pointer may dereference into. There are no real restrictions to what this type can be. However, the user must not assume that simply because a &Target reference is protected, that references indirectly derived (via Deref and other traits) would also be protected. Read more

impl<T> GuardedExt for T where
    T: Guarded
[src]

impl<T, U> GuardedMut for T where
    T: DerefMut<Target = U> + StableDeref + 'static,
    U: ?Sized
[src]

impl<T> GuardedMutExt for T where
    T: GuardedMut
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.