pub struct UObjectRef<T>where
T: UeClass,{ /* private fields */ }Expand description
Implementations§
Source§impl<T> UObjectRef<T>where
T: UeClass,
impl<T> UObjectRef<T>where
T: UeClass,
Sourcepub fn null() -> UObjectRef<T>
pub fn null() -> UObjectRef<T>
No object: what C++ returns as nullptr. Never valid.
Sourcepub unsafe fn from_raw(handle: UObjectHandle) -> UObjectRef<T>
pub unsafe fn from_raw(handle: UObjectHandle) -> UObjectRef<T>
Create from a raw FFI handle.
§Safety
The caller must ensure the handle points to an object whose UClass
is T or a subclass of T.
Sourcepub fn raw(&self) -> UObjectHandle
pub fn raw(&self) -> UObjectHandle
Get the underlying raw handle.
Sourcepub fn checked(&self) -> Result<Checked<T>, RustealError>
pub fn checked(&self) -> Result<Checked<T>, RustealError>
Validate that the object is still alive, returning a Checked<T>
handle that provides infallible access to extension trait methods.
Sourcepub fn cast<U>(self) -> Result<UObjectRef<U>, RustealError>where
U: UeClass,
pub fn cast<U>(self) -> Result<UObjectRef<U>, RustealError>where
U: UeClass,
Cast to a different UClass type. Fails if the object is destroyed
or is not an instance of U.
Sourcepub fn pin(self) -> Result<Pinned<T>, RustealError>
pub fn pin(self) -> Result<Pinned<T>, RustealError>
Upgrade to a Pinned<T>, adding a GC root to keep the object alive.
Sourcepub fn get_name(&self) -> Result<String, RustealError>
pub fn get_name(&self) -> Result<String, RustealError>
Get the object’s FName as a String.
Sourcepub fn get_class(&self) -> Result<UClassHandle, RustealError>
pub fn get_class(&self) -> Result<UClassHandle, RustealError>
Get the object’s UClass handle.
Sourcepub fn get_outer(&self) -> Result<UObjectHandle, RustealError>
pub fn get_outer(&self) -> Result<UObjectHandle, RustealError>
Get the object’s Outer.
Source§impl<T> UObjectRef<T>where
T: HasParent,
impl<T> UObjectRef<T>where
T: HasParent,
Sourcepub fn upcast(self) -> UObjectRef<<T as HasParent>::Parent>
pub fn upcast(self) -> UObjectRef<<T as HasParent>::Parent>
Infallible upcast to the parent class. Zero-cost (same handle).
Source§impl<T> UObjectRef<T>where
T: UeClass,
impl<T> UObjectRef<T>where
T: UeClass,
Sourcepub fn upcast_to<U>(self) -> UObjectRef<U>
pub fn upcast_to<U>(self) -> UObjectRef<U>
Infallible upcast to any ancestor class, checked at compile time
(character.upcast_to::<Object>() for a world context). Zero-cost.
Trait Implementations§
Source§impl<T> Clone for UObjectRef<T>where
T: UeClass,
impl<T> Clone for UObjectRef<T>where
T: UeClass,
Source§fn clone(&self) -> UObjectRef<T>
fn clone(&self) -> UObjectRef<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> ContainerElement for UObjectRef<T>where
T: UeClass,
impl<T> ContainerElement for UObjectRef<T>where
T: UeClass,
Source§const BUF_SIZE: u32
const BUF_SIZE: u32
Source§unsafe fn read_from_buf(buf: *const u8, _written: u32) -> UObjectRef<T>
unsafe fn read_from_buf(buf: *const u8, _written: u32) -> UObjectRef<T>
Source§unsafe fn write_to_buf(&self, buf: *mut u8) -> u32
unsafe fn write_to_buf(&self, buf: *mut u8) -> u32
WriteElement to consume.
Returns the number of bytes written. Read moreSource§const RAW_COPYABLE: bool = false
const RAW_COPYABLE: bool = false
impl<T> Copy for UObjectRef<T>where
T: UeClass,
Source§impl<T> Debug for UObjectRef<T>where
T: UeClass,
impl<T> Debug for UObjectRef<T>where
T: UeClass,
Source§impl<T> Default for UObjectRef<T>where
T: UeClass,
impl<T> Default for UObjectRef<T>where
T: UeClass,
Source§fn default() -> UObjectRef<T>
fn default() -> UObjectRef<T>
No object: nullptr.
Source§impl<T> Deref for UObjectRef<T>where
T: HasParent,
Blanket Deref: UObjectRef<Child> auto-derefs to UObjectRef<Parent>.
Safe because UObjectRef<T> is #[repr(transparent)] over UObjectHandle.
impl<T> Deref for UObjectRef<T>where
T: HasParent,
Blanket Deref: UObjectRef<Child> auto-derefs to UObjectRef<Parent>.
Safe because UObjectRef<T> is #[repr(transparent)] over UObjectHandle.
impl<T> Eq for UObjectRef<T>where
T: UeClass,
Source§impl<T> Hash for UObjectRef<T>where
T: UeClass,
impl<T> Hash for UObjectRef<T>where
T: UeClass,
Source§impl<T> ObjectPointer for UObjectRef<T>where
T: UeClass,
impl<T> ObjectPointer for UObjectRef<T>where
T: UeClass,
Source§unsafe fn from_object_handle(handle: UObjectHandle) -> UObjectRef<T>
unsafe fn from_object_handle(handle: UObjectHandle) -> UObjectRef<T>
Source§fn object_handle(&self) -> UObjectHandle
fn object_handle(&self) -> UObjectHandle
Source§impl<T> PartialEq for UObjectRef<T>where
T: UeClass,
impl<T> PartialEq for UObjectRef<T>where
T: UeClass,
impl<T> Send for UObjectRef<T>where
T: UeClass,
Source§impl<T> UeHandle for UObjectRef<T>where
T: UeClass,
impl<T> UeHandle for UObjectRef<T>where
T: UeClass,
Source§fn checked_handle(&self) -> Result<UObjectHandle, RustealError>
fn checked_handle(&self) -> Result<UObjectHandle, RustealError>
Err(ObjectDestroyed).