Struct gdnative::nativescript::RefInstance [−][src]
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, Access> RefInstance<'a, T, Access> where
Access: ThreadAccess,
T: NativeClass,
[src]
Access: ThreadAccess,
T: NativeClass,
pub fn base(&self) -> TRef<'a, <T as NativeClass>::Base, Access>
[src]
Returns a reference to the base object with the same lifetime.
pub fn script(&self) -> &<T as NativeClass>::UserData
[src]
Returns a reference to the script wrapper.
pub fn try_from_base(
owner: TRef<'a, <T as NativeClass>::Base, Access>
) -> Option<RefInstance<'a, T, Access>>
[src]
owner: TRef<'a, <T as NativeClass>::Base, Access>
) -> Option<RefInstance<'a, T, Access>>
Try to downcast TRef<'a, T::Base, Access>
to RefInstance<T>
.
impl<'a, T, Access> RefInstance<'a, T, Access> where
Access: NonUniqueThreadAccess,
T: NativeClass,
[src]
Access: NonUniqueThreadAccess,
T: NativeClass,
pub fn claim(self) -> Instance<T, Access>
[src]
Persists this into a persistent Instance
with the same thread access, without cloning
the userdata wrapper.
This is only available for non-Unique
accesses.
impl<'a, T, Access> RefInstance<'a, T, Access> where
Access: ThreadAccess,
T: NativeClass,
<T as NativeClass>::Base: GodotObject,
[src]
Access: ThreadAccess,
T: NativeClass,
<T as NativeClass>::Base: GodotObject,
Methods for instances with reference-counted base classes.
pub fn map<F, U>(
&self,
op: F
) -> Result<U, <<T as NativeClass>::UserData as Map>::Err> where
F: FnOnce(&T, TRef<'_, <T as NativeClass>::Base, Access>) -> U,
<T as NativeClass>::UserData: Map,
[src]
&self,
op: F
) -> Result<U, <<T as NativeClass>::UserData as Map>::Err> where
F: FnOnce(&T, TRef<'_, <T as NativeClass>::Base, Access>) -> U,
<T as NativeClass>::UserData: Map,
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 as NativeClass>::UserData as MapMut>::Err> where
F: FnOnce(&mut T, TRef<'_, <T as NativeClass>::Base, Access>) -> U,
<T as NativeClass>::UserData: MapMut,
[src]
&self,
op: F
) -> Result<U, <<T as NativeClass>::UserData as MapMut>::Err> where
F: FnOnce(&mut T, TRef<'_, <T as NativeClass>::Base, Access>) -> U,
<T as NativeClass>::UserData: MapMut,
Calls a function with a NativeClass instance and its owner, and returns its return value.
Trait Implementations
impl<'a, T, Access> Clone for RefInstance<'a, T, Access> where
Access: ThreadAccess,
T: NativeClass,
[src]
Access: ThreadAccess,
T: NativeClass,
pub fn clone(&self) -> RefInstance<'a, T, Access>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, T, Access> Debug for RefInstance<'a, T, Access> where
Access: ThreadAccess + Debug,
T: NativeClass + Debug,
<T as NativeClass>::Base: Debug,
<T as NativeClass>::UserData: Debug,
[src]
Access: ThreadAccess + Debug,
T: NativeClass + Debug,
<T as NativeClass>::Base: Debug,
<T as NativeClass>::UserData: Debug,
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,
[src]
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,
[src]
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,
[src]
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,
[src]
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,
[src]
Access: UnwindSafe,
<T as NativeClass>::Base: RefUnwindSafe,
<T as NativeClass>::UserData: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,