[−][src]Struct gdnative::prelude::TRef
A temporary safe pointer to Godot objects that tracks thread access status. TRef
can be
coerced into bare references with Deref
.
See the type-level documentation on Ref
for detailed documentation on the reference
system of godot-rust
.
Using as method arguments or return values
TRef<T, Shared>
can be passed into methods.
Using as owner
arguments in NativeScript methods
It's possible to use TRef
as the owner
argument in NativeScript methods. This can make
passing owner
to methods easier.
Implementations
impl<'a, T, Access> TRef<'a, T, Access> where
Access: ThreadAccess,
T: GodotObject,
[src]
Access: ThreadAccess,
T: GodotObject,
pub fn as_ref(self) -> &'a T
[src]
Returns the underlying reference without thread access.
pub fn cast<U>(self) -> Option<TRef<'a, U, Access>> where
U: GodotObject + SubClass<T>,
[src]
U: GodotObject + SubClass<T>,
Performs a dynamic reference cast to target type, keeping the thread access info.
pub fn upcast<U>(&self) -> TRef<'a, U, Access> where
T: SubClass<U>,
U: GodotObject,
[src]
T: SubClass<U>,
U: GodotObject,
Performs a static reference upcast to a supertype that is guaranteed to be valid, keeping the thread access info.
This is guaranteed to be a no-op at runtime.
pub fn cast_instance<C>(self) -> Option<RefInstance<'a, C, Access>> where
C: NativeClass<Base = T>,
[src]
C: NativeClass<Base = T>,
Convenience method to downcast to RefInstance
where self
is the base object.
impl<'a, Kind, T, Access> TRef<'a, T, Access> where
Access: NonUniqueThreadAccess,
Kind: RefKind,
T: GodotObject<RefKind = Kind>,
[src]
Access: NonUniqueThreadAccess,
Kind: RefKind,
T: GodotObject<RefKind = Kind>,
pub fn claim(self) -> Ref<T, Access>
[src]
Persists this reference into a persistent Ref
with the same thread access.
This is only available for non-Unique
accesses.
Trait Implementations
impl<'a, T, U> AsArg<U> for TRef<'a, T, Shared> where
T: GodotObject + SubClass<U>,
U: GodotObject,
[src]
T: GodotObject + SubClass<U>,
U: GodotObject,
fn as_arg_ptr(&self) -> *mut c_void
[src]
impl<'a, T, Access> AsRef<T> for TRef<'a, T, Access> where
Access: ThreadAccess,
T: GodotObject,
[src]
Access: ThreadAccess,
T: GodotObject,
impl<'a, T> AsVariant for TRef<'a, T, Shared> where
T: GodotObject,
[src]
T: GodotObject,
type Target = T
impl<'a, T, Access> Borrow<T> for TRef<'a, T, Access> where
Access: ThreadAccess,
T: GodotObject,
[src]
Access: ThreadAccess,
T: GodotObject,
impl<'a, T, Access> Clone for TRef<'a, T, Access> where
Access: ThreadAccess,
T: GodotObject,
[src]
Access: ThreadAccess,
T: GodotObject,
impl<'a, T, Access> Copy for TRef<'a, T, Access> where
Access: ThreadAccess,
T: GodotObject,
[src]
Access: ThreadAccess,
T: GodotObject,
impl<'a, T, Access> Debug for TRef<'a, T, Access> where
Access: ThreadAccess,
T: GodotObject,
[src]
Access: ThreadAccess,
T: GodotObject,
impl<'a, T, Access> Deref for TRef<'a, T, Access> where
Access: ThreadAccess,
T: GodotObject,
[src]
Access: ThreadAccess,
T: GodotObject,
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &<TRef<'a, T, Access> as Deref>::Target
[src]
impl<'a, T, Access> OwnerArg<'a, T, Access> for TRef<'a, T, Access> where
Access: ThreadAccess + 'static,
T: GodotObject,
[src]
Access: ThreadAccess + 'static,
T: GodotObject,
fn from_safe_ref(owner: TRef<'a, T, Access>) -> TRef<'a, T, Access>
[src]
impl<'a, T> ToVariant for TRef<'a, T, Shared> where
T: GodotObject,
[src]
T: GodotObject,
fn to_variant(&self) -> Variant
[src]
Auto Trait Implementations
impl<'a, T, Access> RefUnwindSafe for TRef<'a, T, Access> where
Access: RefUnwindSafe,
T: RefUnwindSafe,
Access: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, Access> Send for TRef<'a, T, Access> where
Access: Send,
T: Sync,
Access: Send,
T: Sync,
impl<'a, T, Access> Sync for TRef<'a, T, Access> where
Access: Sync,
T: Sync,
Access: Sync,
T: Sync,
impl<'a, T, Access> Unpin for TRef<'a, T, Access> where
Access: Unpin,
Access: Unpin,
impl<'a, T, Access> UnwindSafe for TRef<'a, T, Access> where
Access: UnwindSafe,
T: RefUnwindSafe,
Access: UnwindSafe,
T: RefUnwindSafe,
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,
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> OwnedToVariant for T where
T: ToVariant,
[src]
T: ToVariant,
fn owned_to_variant(self) -> Variant
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
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.
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>,