Singleton

Trait Singleton 

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

Trait for singleton classes in Godot.

There is only one instance of each singleton class in the engine, accessible through one().

Required Methods§

fn one() -> Gd<Self>

Returns the singleton instance.

§Panics

If called during global init/deinit of godot-rust. Most singletons are only available after the first frame has run. See also ExtensionLibrary.

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§