[−][src]Struct gdnative::object::RawObject
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]
T: GodotObject,
pub unsafe fn from_sys_ref_unchecked<'a>(
obj: NonNull<c_void>
) -> &'a RawObject<T>
[src]
obj: NonNull<c_void>
) -> &'a RawObject<T>
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]
obj: NonNull<c_void>
) -> Option<&'a RawObject<T>>
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]
U: GodotObject,
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]
U: GodotObject,
Attempt to cast a Godot object to a different class type.
pub unsafe fn cast_unchecked<U>(&self) -> &RawObject<U> where
U: GodotObject,
[src]
U: GodotObject,
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]
impl<T> RawObject<T> where
T: GodotObject<RefKind = RefCounted>,
[src]
T: GodotObject<RefKind = RefCounted>,
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]
T: GodotObject,
Auto Trait Implementations
impl<T> RefUnwindSafe for RawObject<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> !Send for RawObject<T>
impl<T> !Sync for RawObject<T>
impl<T> Unpin for RawObject<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for RawObject<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,