godot::obj

Trait AsObjectArg

pub trait AsObjectArg<T>
where T: GodotClass<Declarer = DeclEngine> + Bounds,
{ }
Expand description

Objects that can be passed as arguments to Godot engine functions.

This trait is implemented for the following types:

  • Gd<T> and &Gd<T>, to pass objects. Subclasses of T are explicitly supported.
  • Option<Gd<T>> and Option<&Gd<T>>, to pass optional objects. None is mapped to a null argument.
  • Gd::null_arg(), to pass null arguments without using Option.

§Nullability

The GDExtension API does not inform about nullability of its function parameters. It is up to you to verify that the arguments you pass are only null when this is allowed. Doing this wrong should be safe, but can lead to the function call failing.

Implementations on Foreign Types§

§

impl<T, U> AsObjectArg<T> for Option<U>
where T: GodotClass<Declarer = DeclEngine> + Bounds, U: AsObjectArg<T>,

Implementors§

§

impl<T, U> AsObjectArg<T> for &Gd<U>
where T: GodotClass<Declarer = DeclEngine> + Bounds, U: Inherits<T>,

§

impl<T, U> AsObjectArg<T> for &mut Gd<U>
where T: GodotClass<Declarer = DeclEngine> + Bounds, U: Inherits<T>,

§

impl<T, U> AsObjectArg<T> for Gd<U>
where T: GodotClass<Declarer = DeclEngine> + Bounds, U: Inherits<T>,