[−][src]Trait gdnative_core::user_data::UserData
Trait for customizable user-data wrappers.
See module-level documentation for detailed explanation on user-data.
Associated Types
type Target: NativeClass
Required methods
fn new(val: Self::Target) -> Self
Creates a new owned wrapper from a NativeClass instance.
This operation must never fail.
unsafe fn into_user_data(self) -> *const c_void
Takes a native instance and returns an opaque pointer that can be used to recover it.
This gives "ownership" to the engine.
This operation must never fail.
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.
This should be used when "ownership" is taken from the engine, i.e. destructors. Use elsewhere can lead to premature drops of the instance contained inside.
ptr is guaranteed to be non-null.
This operation must never fail.
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.
This should be used when user data is "borrowed" from the engine.
ptr is guaranteed to be non-null.
This operation must never fail.
Implementors
impl<T> UserData for Aether<T> where
T: NativeClass + Copy + Default, [src]
T: NativeClass + Copy + Default,
type Target = T
fn new(_val: Self::Target) -> Self[src]
unsafe fn into_user_data(self) -> *const c_void[src]
unsafe fn consume_user_data_unchecked(_ptr: *const c_void) -> Self[src]
unsafe fn clone_from_user_data_unchecked(_ptr: *const c_void) -> Self[src]
impl<T> UserData for ArcData<T> where
T: NativeClass + Send + Sync, [src]
T: NativeClass + Send + Sync,
type Target = T
fn new(val: Self::Target) -> Self[src]
unsafe fn into_user_data(self) -> *const c_void[src]
unsafe fn consume_user_data_unchecked(ptr: *const c_void) -> Self[src]
unsafe fn clone_from_user_data_unchecked(ptr: *const c_void) -> Self[src]
impl<T> UserData for LocalCellData<T> where
T: NativeClass, [src]
T: NativeClass,
type Target = T
fn new(val: Self::Target) -> Self[src]
unsafe fn into_user_data(self) -> *const c_void[src]
unsafe fn consume_user_data_unchecked(ptr: *const c_void) -> Self[src]
unsafe fn clone_from_user_data_unchecked(ptr: *const c_void) -> Self[src]
impl<T, OPT> UserData for MutexData<T, OPT> where
T: NativeClass + Send,
OPT: LockOptions, [src]
T: NativeClass + Send,
OPT: LockOptions,
type Target = T
fn new(val: Self::Target) -> Self[src]
unsafe fn into_user_data(self) -> *const c_void[src]
unsafe fn consume_user_data_unchecked(ptr: *const c_void) -> Self[src]
unsafe fn clone_from_user_data_unchecked(ptr: *const c_void) -> Self[src]
impl<T, OPT> UserData for RwLockData<T, OPT> where
T: NativeClass + Send + Sync,
OPT: LockOptions, [src]
T: NativeClass + Send + Sync,
OPT: LockOptions,