godot::obj

Trait NewGd

pub trait NewGd: GodotClass {
    // Required method
    fn new_gd() -> Gd<Self>;
}
Expand description

Extension trait for all reference-counted classes.

Required Methods§

fn new_gd() -> Gd<Self>

Return a new, ref-counted Gd containing a default-constructed instance.

MyClass::new_gd() is equivalent to Gd::<MyClass>::default().

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.

Implementors§

§

impl<T> NewGd for T
where T: GodotDefault<Memory = MemRefCounted> + Bounds,