#[repr(C)]pub struct Il2CppObject<T> {
pub klass: &'static mut Il2CppClass,
pub fields: T,
/* private fields */
}
Expand description
Wrapper structure for a class instance provided by Il2Cpp.
It contains a pointer to the class it represents as well as its own copy of the fields in the class.
Every class instance is represented by this type and passed by reference.
Define the fields of the class as a structure and pass them as a generic.
Example:
pub fn hooked_method(proc: &Il2CppObject<ProcInst>) {
// ...
}
Fields§
§klass: &'static mut Il2CppClass
The class this instance refers to.
Be aware that editing it means editing every other object using the same class.
Use carefully.
fields: T
Implementations§
source§impl<T> Il2CppObject<T>
impl<T> Il2CppObject<T>
pub fn get_class(&self) -> &Il2CppClass
pub fn get_class_mut(&mut self) -> &mut Il2CppClass
sourcepub fn from_class(class: &Il2CppClass) -> Il2CppResult<&'static mut T>
pub fn from_class(class: &Il2CppClass) -> Il2CppResult<&'static mut T>
Create a unique Il2CppObject
instance of the Il2CppClass
provided.
source§impl Il2CppObject<SystemString>
impl Il2CppObject<SystemString>
sourcepub fn new<'a>(string: impl AsRef<str>) -> &'a Il2CppString
pub fn new<'a>(string: impl AsRef<str>) -> &'a Il2CppString
Create a new instance of a SystemString using the provided value.
Internally turned into a CString
, so make sure the provided value is a valid UTF-8 string.
Example:
let string = Il2CppString::new("A new string");
```j
pub fn new_static(string: impl AsRef<str>) -> &'static mut Il2CppString
pub fn get_string(&self) -> Result<String, FromUtf16Error>
👎Deprecated: Use Il2CppString::to_string instead
pub fn to_string(&self) -> String
pub fn to_lowercase(&self) -> &mut Il2CppString
pub fn starts_with<'a>(&self, value: impl Into<&'a Il2CppString>) -> bool
pub fn contains<'a>(&self, value: impl Into<&'a Il2CppString>) -> bool
pub fn replace<'a>( &mut self, old_value: impl Into<&'a Il2CppString>, new_value: impl Into<&'a Il2CppString>, ) -> &mut Il2CppString
sourcepub fn clone(&self) -> &Il2CppString
pub fn clone(&self) -> &Il2CppString
Provides a new instance of the Il2CppString, separate from the original.
pub fn clone_mut(&mut self) -> &mut Il2CppString
pub fn copy(&self) -> &Il2CppString
pub fn copy_mut(&mut self) -> &mut Il2CppString
pub fn get_hash_code(&self) -> i32
Trait Implementations§
source§impl<T> AsMut<T> for Il2CppObject<T>
impl<T> AsMut<T> for Il2CppObject<T>
source§impl<T> AsRef<T> for Il2CppObject<T>
impl<T> AsRef<T> for Il2CppObject<T>
source§impl<T> Deref for Il2CppObject<T>
impl<T> Deref for Il2CppObject<T>
Auto Trait Implementations§
impl<T> Freeze for Il2CppObject<T>where
T: Freeze,
impl<T> RefUnwindSafe for Il2CppObject<T>where
T: RefUnwindSafe,
impl<T> !Send for Il2CppObject<T>
impl<T> !Sync for Il2CppObject<T>
impl<T> Unpin for Il2CppObject<T>where
T: Unpin,
impl<T> !UnwindSafe for Il2CppObject<T>
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more