#[repr(transparent)]pub struct Object {
pub ptr: *mut Il2cppObject,
}Expand description
Safe-ish wrapper around a managed IL2CPP object pointer.
Use this type when you already have a live managed object and want instance-bound access to methods, fields, or properties.
Fields§
§ptr: *mut Il2cppObjectPointer to the internal IL2CPP object structure
Implementations§
Source§impl Object
impl Object
Sourcepub fn field(&self, name: &str) -> Option<Field>
pub fn field(&self, name: &str) -> Option<Field>
Returns an instance-bound field lookup.
The returned Field carries this object’s instance pointer so
Field::get_value and
Field::set_value can operate on it.
Sourcepub fn method<S: MethodSelector>(&self, selector: S) -> Option<Method>
pub fn method<S: MethodSelector>(&self, selector: S) -> Option<Method>
Returns an instance-bound method lookup.
This is the preferred way to prepare instance method calls because the
returned Method already carries the correct this pointer.
Sourcepub fn property(&self, name: &str) -> Option<Property>
pub fn property(&self, name: &str) -> Option<Property>
Returns an instance-bound property lookup.
Sourcepub fn il2cpp_to_string(&self) -> String
pub fn il2cpp_to_string(&self) -> String
Sourcepub fn get_game_object(&self) -> Result<GameObject, String>
pub fn get_game_object(&self) -> Result<GameObject, String>
Gets the GameObject associated with this object (if Is a Component)
§Returns
Result<GameObject, String>- The GameObject, or an error if null/not found
Sourcepub fn get_header_size() -> usize
pub fn get_header_size() -> usize
Gets the size of the object header
This is cached for performance.
§Returns
usize- The size of the header in bytes
Sourcepub fn get_virtual_method(&self, method: &Method) -> *mut c_void
pub fn get_virtual_method(&self, method: &Method) -> *mut c_void
Sourcepub fn init_exception(&self, exc: &mut c_void)
pub fn init_exception(&self, exc: &mut c_void)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Object
impl RefUnwindSafe for Object
impl !Send for Object
impl !Sync for Object
impl Unpin for Object
impl UnsafeUnpin for Object
impl UnwindSafe for Object
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