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.

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> NewAlloc for T
where T: GodotDefault<Memory = MemManual> + Bounds,