pub struct Handle<T>(/* private fields */);
Implementations§
Source§impl<T> Handle<T>
impl<T> Handle<T>
Sourcepub fn from_instance(t: T) -> Self
pub fn from_instance(t: T) -> Self
Wrap a struct instance into a handle.
Sourcepub fn from_ref_mut(t: &mut T) -> &mut Self
pub fn from_ref_mut(t: &mut T) -> &mut Self
Wrap a mutable struct reference into a mutable handle.
Sourcepub fn from_ptr_mut(tp: *mut T) -> *mut Self
pub fn from_ptr_mut(tp: *mut T) -> *mut Self
Wrap a mut pointer into a mut handle pointer.
Sourcepub fn replace(self, t: &mut T) -> Self
pub fn replace(self, t: &mut T) -> Self
Replaces the instance with the one from this Handle, and returns the replaced one wrapped in a Handle without dropping either one.
Sourcepub fn into_instance(self) -> T
pub fn into_instance(self) -> T
Consumes the wrapper and returns the wrapped type.
Sourcepub fn instance_mut(&mut self) -> &mut T
pub fn instance_mut(&mut self) -> &mut T
Returns a mutable reference to the wrapped type.
Trait Implementations§
impl<T> Send for Handle<T>
impl<T> Sync for Handle<T>
Auto Trait Implementations§
impl<T> Freeze for Handle<T>where
T: Freeze,
impl<T> RefUnwindSafe for Handle<T>where
T: RefUnwindSafe,
impl<T> Unpin for Handle<T>where
T: Unpin,
impl<T> UnwindSafe for Handle<T>where
T: UnwindSafe,
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