Trait gdnative::object::AsArg

source ·
pub trait AsArg<T>: Sealed { }
Expand description

Trait for safe conversion from Godot object references into API method arguments. This is a sealed trait with no public interface.

In order to enforce thread safety statically, the ability to be passed to the engine is only given to some reference types. Specifically, they are:

  • All owned Ref<T, Unique> references. The Unique access is lost if passed into a method.
  • Owned and borrowed Shared references, including temporary ones (TRef).

It’s unsound to pass ThreadLocal references to the engine because there is no guarantee that the reference will stay on the same thread.

To explicitly pass a null reference to the engine, use Null::null or GodotObject::null.

Implementors§

source§

impl<'a, T, U> AsArg<U> for &'a Instance<T, Shared>where
    T: NativeClass,
    <T as NativeClass>::Base: GodotObject + SubClass<U>,
    <T as NativeClass>::UserData: Map,
    U: GodotObject,

source§

impl<'a, T, U> AsArg<U> for &'a Ref<T, Shared>where
    T: GodotObject + SubClass<U>,
    U: GodotObject,

source§

impl<'a, T, U> AsArg<U> for TInstance<'a, T, Shared>where
    T: NativeClass,
    <T as NativeClass>::Base: GodotObject + SubClass<U>,
    <T as NativeClass>::UserData: Map,
    U: GodotObject,

source§

impl<'a, T, U> AsArg<U> for TRef<'a, T, Shared>where
    T: GodotObject + SubClass<U>,
    U: GodotObject,

source§

impl<T> AsArg<T> for Null<T>where
    T: GodotObject,

source§

impl<T, U> AsArg<U> for Ref<T, Shared>where
    T: GodotObject + SubClass<U>,
    U: GodotObject,

source§

impl<T, U> AsArg<U> for Ref<T, Unique>where
    T: GodotObject + SubClass<U>,
    U: GodotObject,

source§

impl<T, U, Own> AsArg<U> for Instance<T, Own>where
    Own: Ownership,
    T: NativeClass,
    <T as NativeClass>::Base: GodotObject + SubClass<U>,
    <T as NativeClass>::UserData: Map,
    U: GodotObject,