godot::obj

Trait NewAlloc

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

Extension trait for all manually managed classes.

Required Methods§

fn new_alloc() -> Gd<Self>

Return a new, manually-managed Gd containing a default-constructed instance.

The result must be manually managed, e.g. by attaching it to the scene tree or calling free() after usage. Failure to do so will result in memory leaks.

Object Safety§

This trait is not object safe.

Implementors§

§

impl<T> NewAlloc for T
where T: GodotDefault<Memory = MemManual> + Bounds,