[][src]Struct gdnative::object::RawObject

#[repr(C)]pub struct RawObject<T> { /* fields omitted */ }

An opaque struct representing Godot objects. This should never be created on the stack.

This is an internal interface. Users are expected to use references to named generated types instead.

Implementations

impl<T> RawObject<T> where
    T: GodotObject
[src]

pub unsafe fn from_sys_ref_unchecked<'a>(
    obj: NonNull<c_void>
) -> &'a RawObject<T>
[src]

Creates a typed reference from a pointer, without checking the type of the pointer.

Safety

The obj pointer must be pointing to a valid Godot object of type T during the entirety of 'a.

pub unsafe fn try_from_sys_ref<'a>(
    obj: NonNull<c_void>
) -> Option<&'a RawObject<T>>
[src]

Creates a typed reference from a pointer if the pointer is pointing to an object of the correct type. Returns None otherwise.

Safety

The obj pointer must be pointing to a valid Godot object during the entirety of 'a.

pub fn sys(&self) -> NonNull<c_void>[src]

Casts a reference to this opaque object to *const sys::godot_object.

pub fn is_class<U>(&self) -> bool where
    U: GodotObject
[src]

Checks whether the object is of a certain Godot class.

pub fn is_class_by_name(&self, class_name: &str) -> bool[src]

Checks whether the object is of a certain Godot class by name.

pub fn class_name(&self) -> String[src]

Returns the class name of this object dynamically using Object::get_class.

pub fn cast<U>(&self) -> Option<&RawObject<U>> where
    U: GodotObject
[src]

Attempt to cast a Godot object to a different class type.

pub unsafe fn cast_unchecked<U>(&self) -> &RawObject<U> where
    U: GodotObject
[src]

Attempt to cast a Godot object to a different class type without checking the type at runtime.

Safety

The types must be compatible.

pub unsafe fn free(&self)[src]

Free the underlying object.

Safety

Further operations must not be performed on the same reference.

impl<T> RawObject<T> where
    T: GodotObject<RefKind = RefCounted>, 
[src]

pub fn add_ref(&self)[src]

Increase the reference count of the object.

pub unsafe fn unref(&self) -> bool[src]

Decrease the reference count of the object. Returns true if this is the last reference.

Safety

Further operations must not be performed on the same reference if this is the last reference.

pub unsafe fn unref_and_free_if_last(&self) -> bool[src]

Decrease the reference count of the object. Frees the object and returns true if this is the last reference.

Safety

Further operations must not be performed on the same reference if this is the last reference.

pub unsafe fn init_ref_count(&self)[src]

Initialize the reference count of the object.

Safety

This function assumes that no other references are held at the time.

Trait Implementations

impl<T> Debug for RawObject<T> where
    T: GodotObject
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for RawObject<T> where
    T: RefUnwindSafe

impl<T> !Send for RawObject<T>

impl<T> !Sync for RawObject<T>

impl<T> Unpin for RawObject<T> where
    T: Unpin

impl<T> UnwindSafe for RawObject<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.