pub struct Mapped<T, U>{ /* private fields */ }
Expand description
A mapped guard, which contains a guarded owned pointer, and an immutable 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§
Source§impl<T, U> Mapped<T, U>
impl<T, U> Mapped<T, U>
Sourcepub fn into_original(self) -> T
pub fn into_original(self) -> T
Move the inner guarded pointer out from the Mapped
wrapper, cancelling the temporary
borrow.
Sourcepub fn original_by_ref(&self) -> &T
pub fn original_by_ref(&self) -> &T
Get the original pointer, by immutable reference.
Trait Implementations§
Source§impl<T, U> Guarded for Mapped<T, U>
impl<T, U> Guarded for Mapped<T, U>
Source§type Target = U
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.Source§fn borrow_guarded(&self) -> &Self::Target
fn borrow_guarded(&self) -> &Self::Target
Borrow the pointee, into a fixed reference that can be sent directly and safely to e.g.
memory-sharing completion-based I/O interfaces. Read more
Auto Trait Implementations§
impl<T, U> Freeze for Mapped<T, U>
impl<T, U> RefUnwindSafe for Mapped<T, U>
impl<T, U> !Send for Mapped<T, U>
impl<T, U> !Sync for Mapped<T, U>
impl<T, U> Unpin for Mapped<T, U>
impl<T, U> UnwindSafe for Mapped<T, U>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more