Struct type_handle::Handle
source · pub struct Handle<T>(_, _);
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(tp: *const T) -> *const Self
pub fn from_ptr(tp: *const T) -> *const Self
Wrap a const pointer into a const handle pointer.
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§
source§impl<T: PartialEq> PartialEq<Handle<T>> for Handle<T>
impl<T: PartialEq> PartialEq<Handle<T>> for Handle<T>
impl<T> Send for Handle<T>
impl<T> Sync for Handle<T>
Auto Trait Implementations§
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