[−][src]Struct guard_trait::MappedMut
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]
T: GuardedMut,
U: ?Sized,
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]
F: FnOnce(&mut U) -> &mut V,
V: ?Sized,
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]
F: FnOnce(&mut U) -> Result<&mut V, E>,
V: ?Sized,
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]
T: GuardedMut,
U: ?Sized,
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
fn borrow_guarded(&self) -> &Self::Target
[src]
impl<T, U> GuardedMut for MappedMut<T, U> where
T: GuardedMut,
U: ?Sized,
[src]
T: GuardedMut,
U: ?Sized,
fn borrow_guarded_mut(&mut self) -> &mut Self::Target
[src]
Auto Trait Implementations
impl<T, U: ?Sized> RefUnwindSafe for MappedMut<T, U> where
T: RefUnwindSafe,
U: RefUnwindSafe,
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,
T: Unpin,
impl<T, U: ?Sized> UnwindSafe for MappedMut<T, U> where
T: UnwindSafe,
U: RefUnwindSafe,
T: UnwindSafe,
U: RefUnwindSafe,
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Guarded for T where
T: Deref<Target = U> + StableDeref + 'static,
U: ?Sized,
[src]
T: Deref<Target = U> + StableDeref + 'static,
U: ?Sized,
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
pub fn borrow_guarded(&Self) -> &U
[src]
impl<T> GuardedExt for T where
T: Guarded,
[src]
T: Guarded,
fn map<F, T>(this: Self, f: F) -> Mapped<Self, T> where
F: FnOnce(&Self::Target) -> &T,
T: ?Sized,
[src]
F: FnOnce(&Self::Target) -> &T,
T: ?Sized,
fn try_map<F, T, E>(this: Self, f: F) -> Result<Mapped<Self, T>, E> where
F: FnOnce(&Self::Target) -> Result<&T, E>,
T: ?Sized,
[src]
F: FnOnce(&Self::Target) -> Result<&T, E>,
T: ?Sized,
impl<T, U> GuardedMut for T where
T: DerefMut<Target = U> + StableDeref + 'static,
U: ?Sized,
[src]
T: DerefMut<Target = U> + StableDeref + 'static,
U: ?Sized,
pub fn borrow_guarded_mut(&mut Self) -> &mut U
[src]
impl<T> GuardedMutExt for T where
T: GuardedMut,
[src]
T: GuardedMut,
fn map_mut<F, T>(this: Self, f: F) -> MappedMut<Self, T> where
F: FnOnce(&mut Self::Target) -> &mut T,
T: ?Sized,
[src]
F: FnOnce(&mut Self::Target) -> &mut T,
T: ?Sized,
fn try_map_mut<F, T, E>(this: Self, f: F) -> Result<MappedMut<Self, T>, E> where
F: FnOnce(&mut Self::Target) -> Result<&mut T, E>,
T: ?Sized,
[src]
F: FnOnce(&mut Self::Target) -> Result<&mut T, E>,
T: ?Sized,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,