Trait NewAlloc

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

Extension trait for all manually managed classes.

Required Methods§

Source

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.

§Panics

If Self is user-defined and its default constructor init() panics, that panic is propagated to the caller.

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§

Source§

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