[][src]Trait gdnative_core::GodotObject

pub unsafe trait GodotObject: Sealed {
    fn class_name() -> &'static str;

    unsafe fn claim(&self) -> Self
    where
        Self: Sized
, { ... } }

Trait for Godot API objects. This trait is sealed, and implemented for generated wrapper types.

Remarks

The cast method on Godot object types is only for conversion between engine types. To downcast a NativeScript type from its base type, see Instance::try_from_base.

Required methods

fn class_name() -> &'static str

Loading content...

Provided methods

unsafe fn claim(&self) -> Self where
    Self: Sized

Creates a wrapper around the same Godot object that has 'static lifetime.

Most Godot APIs expect object arguments with 'static lifetime. This method may be used to produce a 'static wrapper given a reference. For reference-counted types, or classes that extend Reference, this increments the reference count. For manually-managed types, including all classes that inherit Node, this creates an alias.

Remarks

Although manually-managed types are already unsafe to use, like raw pointers, this is unsafe because some methods expect &mut self receivers. In 0.9.0, all methods will take shared references instead, making this safe to call.

Loading content...

Implementors

impl GodotObject for Object[src]

impl GodotObject for Reference[src]

Loading content...