pub struct UObjectRef<T: UeClass> { /* private fields */ }Expand description
Implementations§
Source§impl<T: UeClass> UObjectRef<T>
impl<T: UeClass> UObjectRef<T>
Sourcepub unsafe fn from_raw(handle: UObjectHandle) -> Self
pub unsafe fn from_raw(handle: UObjectHandle) -> Self
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) -> RustealResult<Checked<T>>
pub fn checked(&self) -> RustealResult<Checked<T>>
Validate that the object is still alive, returning a Checked<T>
handle that provides infallible access to extension trait methods.
Sourcepub fn cast<U: UeClass>(self) -> RustealResult<UObjectRef<U>>
pub fn cast<U: UeClass>(self) -> RustealResult<UObjectRef<U>>
Cast to a different UClass type. Fails if the object is destroyed
or is not an instance of U.
Sourcepub fn pin(self) -> RustealResult<Pinned<T>>
pub fn pin(self) -> RustealResult<Pinned<T>>
Upgrade to a Pinned<T>, adding a GC root to keep the object alive.
Sourcepub fn get_name(&self) -> RustealResult<String>
pub fn get_name(&self) -> RustealResult<String>
Get the object’s FName as a String.
Sourcepub fn get_class(&self) -> RustealResult<UClassHandle>
pub fn get_class(&self) -> RustealResult<UClassHandle>
Get the object’s UClass handle.
Sourcepub fn get_outer(&self) -> RustealResult<UObjectHandle>
pub fn get_outer(&self) -> RustealResult<UObjectHandle>
Get the object’s Outer.
Source§impl<T: HasParent> UObjectRef<T>
impl<T: HasParent> UObjectRef<T>
Sourcepub fn upcast(self) -> UObjectRef<T::Parent>
pub fn upcast(self) -> UObjectRef<T::Parent>
Infallible upcast to the parent class. Zero-cost (same handle).
Trait Implementations§
Source§impl<T: UeClass> ContainerElement for UObjectRef<T>
impl<T: UeClass> ContainerElement for UObjectRef<T>
Source§const BUF_SIZE: u32
const BUF_SIZE: u32
Buffer size for FFI transport. Must be large enough for the C++ side
to write the element value.
Source§unsafe fn read_from_buf(buf: *const u8, _written: u32) -> Self
unsafe fn read_from_buf(buf: *const u8, _written: u32) -> Self
Interpret bytes from the C++ side into a Rust value. Read more
Source§unsafe fn write_to_buf(&self, buf: *mut u8) -> u32
unsafe fn write_to_buf(&self, buf: *mut u8) -> u32
Write this value into a buffer for C++
WriteElement to consume.
Returns the number of bytes written. Read moreSource§const RAW_COPYABLE: bool = false
const RAW_COPYABLE: bool = false
Whether this type can be bulk-copied as raw bytes (no per-element framing).
True for fixed-size primitives (bool, integers, floats) and FName.
impl<T: Copy + UeClass> Copy for UObjectRef<T>
Source§impl<T: UeClass> Debug for UObjectRef<T>
impl<T: UeClass> Debug for UObjectRef<T>
Source§impl<T: HasParent> Deref for UObjectRef<T>
Blanket Deref: UObjectRef<Child> auto-derefs to UObjectRef<Parent>.
Safe because UObjectRef<T> is #[repr(transparent)] over UObjectHandle.
impl<T: HasParent> Deref for UObjectRef<T>
Blanket Deref: UObjectRef<Child> auto-derefs to UObjectRef<Parent>.
Safe because UObjectRef<T> is #[repr(transparent)] over UObjectHandle.
impl<T: Eq + UeClass> Eq for UObjectRef<T>
Source§impl<T: UeClass> ObjectPointer for UObjectRef<T>
impl<T: UeClass> ObjectPointer for UObjectRef<T>
Source§unsafe fn from_object_handle(handle: UObjectHandle) -> Self
unsafe fn from_object_handle(handle: UObjectHandle) -> Self
Wrap a pointer the engine returned. Read more
Source§fn object_handle(&self) -> UObjectHandle
fn object_handle(&self) -> UObjectHandle
The pointer to hand to the engine.
impl<T: UeClass> Send for UObjectRef<T>
impl<T: PartialEq + UeClass> StructuralPartialEq for UObjectRef<T>
Source§impl<T: UeClass> UeHandle for UObjectRef<T>
impl<T: UeClass> UeHandle for UObjectRef<T>
Source§fn checked_handle(&self) -> RustealResult<UObjectHandle>
fn checked_handle(&self) -> RustealResult<UObjectHandle>
Return the raw handle if the object is alive, or
Err(ObjectDestroyed).Source§fn raw_handle(&self) -> UObjectHandle
fn raw_handle(&self) -> UObjectHandle
Return the raw handle without validity check.
Auto Trait Implementations§
impl<T> !Sync for UObjectRef<T>
impl<T> Freeze for UObjectRef<T>
impl<T> RefUnwindSafe for UObjectRef<T>
impl<T> Unpin for UObjectRef<T>
impl<T> UnsafeUnpin for UObjectRef<T>
impl<T> UnwindSafe for UObjectRef<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more