Skip to main content

AsDirectElement

Trait AsDirectElement 

pub trait AsDirectElement<T>: AsArg<T>
where T: Element,
{ }
Expand description

Marker trait for types directly usable in the array! and dict! macros.

More restrictive than AsArg<T> — avoids ambiguity once AsArg<Variant> impls are added. Implemented for:

  • T when T: Element + ToGodot<Pass = ByValue> (e.g. i32, bool, Color).
  • &T when T: Element + ToGodot<Pass = ByRef> (e.g. &GString, &Array<T>).
  • &str, &String for GString (only; not StringName/NodePath to avoid ambiguity).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl AsDirectElement<GString> for &str

§

impl AsDirectElement<GString> for &String

§

impl<T> AsDirectElement<T> for &T
where T: Element<Pass = ByRef> + ToGodot,

Implementors§

§

impl<T> AsDirectElement<T> for T
where T: Element<Pass = ByValue> + ToGodot,