[][src]Struct gdnative_core::nativescript::class::RefInstance

pub struct RefInstance<'a, T: NativeClass, Access: ThreadAccess> { /* fields omitted */ }

A reference to a GodotObject with a rust NativeClass attached that is assumed safe during a certain lifetime.

See the type-level documentation on Ref for more information on typed thread accesses.

Implementations

impl<'a, T: NativeClass, Access: ThreadAccess> RefInstance<'a, T, Access>[src]

pub fn base(&self) -> TRef<'a, T::Base, Access>[src]

Returns a reference to the base object with the same lifetime.

pub fn script(&self) -> &T::UserData[src]

Returns a reference to the script wrapper.

pub fn try_from_base(owner: TRef<'a, T::Base, Access>) -> Option<Self>[src]

Try to downcast TRef<'a, T::Base, Access> to RefInstance<T>.

impl<'a, T: NativeClass, Access: ThreadAccess> RefInstance<'a, T, Access> where
    T::Base: GodotObject
[src]

Methods for instances with reference-counted base classes.

pub fn map<F, U>(&self, op: F) -> Result<U, <T::UserData as Map>::Err> where
    T::UserData: Map,
    F: FnOnce(&T, TRef<T::Base, Access>) -> U, 
[src]

Calls a function with a NativeClass instance and its owner, and returns its return value.

pub fn map_mut<F, U>(&self, op: F) -> Result<U, <T::UserData as MapMut>::Err> where
    T::UserData: MapMut,
    F: FnOnce(&mut T, TRef<T::Base, Access>) -> U, 
[src]

Calls a function with a NativeClass instance and its owner, and returns its return value.

Trait Implementations

impl<'a, T, Access: ThreadAccess> Clone for RefInstance<'a, T, Access> where
    T: NativeClass
[src]

impl<'a, T: Debug + NativeClass, Access: Debug + ThreadAccess> Debug for RefInstance<'a, T, Access> where
    T::Base: Debug,
    T::UserData: Debug
[src]

Auto Trait Implementations

impl<'a, T, Access> RefUnwindSafe for RefInstance<'a, T, Access> where
    Access: RefUnwindSafe,
    <T as NativeClass>::Base: RefUnwindSafe,
    <T as NativeClass>::UserData: RefUnwindSafe

impl<'a, T, Access> Send for RefInstance<'a, T, Access> where
    Access: Send,
    <T as NativeClass>::Base: Sync,
    <T as NativeClass>::UserData: Send

impl<'a, T, Access> Sync for RefInstance<'a, T, Access> where
    Access: Sync,
    <T as NativeClass>::Base: Sync,
    <T as NativeClass>::UserData: Sync

impl<'a, T, Access> Unpin for RefInstance<'a, T, Access> where
    Access: Unpin,
    <T as NativeClass>::UserData: Unpin

impl<'a, T, Access> UnwindSafe for RefInstance<'a, T, Access> where
    Access: UnwindSafe,
    <T as NativeClass>::Base: RefUnwindSafe,
    <T as NativeClass>::UserData: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.