pub struct ArcData<T>(_);
Expand description
User-data wrapper encapsulating a Arc<T>
. Does not implement MapMut
.
Implementations
sourceimpl<T> ArcData<T>
impl<T> ArcData<T>
sourcepub fn into_inner(self) -> Arc<T>
pub fn into_inner(self) -> Arc<T>
Returns the internal Arc<T>
. Useful for API’s that require an Arc
directly, or for coercing it into a trait object.
Note that this removes
the restriction of only being able to access the NativeClass
instance
temporarily through the Map
trait; however, it should be exactly as safe
as permanently storing an owned ArcData
and then calling .map()
on
it later.
Trait Implementations
sourceimpl<T> Map for ArcData<T>where
T: NativeClass + Send + Sync,
impl<T> Map for ArcData<T>where
T: NativeClass + Send + Sync,
type Err = Infallible
sourceimpl<T> UserData for ArcData<T>where
T: NativeClass + Send + Sync,
impl<T> UserData for ArcData<T>where
T: NativeClass + Send + Sync,
type Target = T
sourcefn new(val: Self::Target) -> Self
fn new(val: Self::Target) -> Self
Creates a new owned wrapper from a
NativeClass
instance. Read moresourcefn into_user_data(self) -> *const c_void
fn into_user_data(self) -> *const c_void
Takes a native instance and returns an opaque pointer that can be used to recover it. Read more
sourceunsafe fn consume_user_data_unchecked(ptr: *const c_void) -> Self
unsafe fn consume_user_data_unchecked(ptr: *const c_void) -> Self
Takes an opaque pointer produced by
into_user_data
and “consumes” it to produce the
original instance, keeping the reference count. Read moresourceunsafe fn clone_from_user_data_unchecked(ptr: *const c_void) -> Self
unsafe fn clone_from_user_data_unchecked(ptr: *const c_void) -> Self
Takes an opaque pointer produced by
into_user_data
and “clones” it to produce the
original instance, increasing the reference count. Read moreAuto Trait Implementations
impl<T> RefUnwindSafe for ArcData<T>where
T: RefUnwindSafe,
impl<T> Send for ArcData<T>where
T: Send + Sync,
impl<T> Sync for ArcData<T>where
T: Send + Sync,
impl<T> Unpin for ArcData<T>
impl<T> UnwindSafe for ArcData<T>where
T: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more