#[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) -> Result<&'static mut T, Il2CppError>
pub fn from_class(class: &Il2CppClass) -> Result<&'static mut T, Il2CppError>
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 Il2CppObject<SystemString>
pub fn new<'a>(string: impl AsRef<str>) -> &'a Il2CppObject<SystemString>
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 Il2CppObject<SystemString>
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 Il2CppObject<SystemString>
pub fn starts_with<'a>( &self, value: impl Into<&'a Il2CppObject<SystemString>>, ) -> bool
pub fn contains<'a>( &self, value: impl Into<&'a Il2CppObject<SystemString>>, ) -> bool
pub fn replace<'a>( &mut self, old_value: impl Into<&'a Il2CppObject<SystemString>>, new_value: impl Into<&'a Il2CppObject<SystemString>>, ) -> &mut Il2CppObject<SystemString>
sourcepub fn clone(&self) -> &Il2CppObject<SystemString>
pub fn clone(&self) -> &Il2CppObject<SystemString>
Provides a new instance of the Il2CppString, separate from the original.
pub fn clone_mut(&mut self) -> &mut Il2CppObject<SystemString>
pub fn copy(&self) -> &Il2CppObject<SystemString>
pub fn copy_mut(&mut self) -> &mut Il2CppObject<SystemString>
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>
source§impl<T> DerefMut for Il2CppObject<T>
impl<T> DerefMut for Il2CppObject<T>
source§fn deref_mut(&mut self) -> &mut <Il2CppObject<T> as Deref>::Target
fn deref_mut(&mut self) -> &mut <Il2CppObject<T> as Deref>::Target
Mutably dereferences the value.
source§impl Display for Il2CppObject<SystemString>
impl Display for Il2CppObject<SystemString>
source§impl<T> From<T> for &Il2CppObject<SystemString>where
T: AsRef<str>,
impl<T> From<T> for &Il2CppObject<SystemString>where
T: AsRef<str>,
source§fn from(value: T) -> &Il2CppObject<SystemString>
fn from(value: T) -> &Il2CppObject<SystemString>
Converts to this type from the input type.
source§impl<T> From<T> for &mut Il2CppObject<SystemString>where
T: AsRef<str>,
impl<T> From<T> for &mut Il2CppObject<SystemString>where
T: AsRef<str>,
source§fn from(value: T) -> &mut Il2CppObject<SystemString>
fn from(value: T) -> &mut Il2CppObject<SystemString>
Converts to this type from the input type.
source§impl FromStr for &Il2CppObject<SystemString>
impl FromStr for &Il2CppObject<SystemString>
source§fn from_str(
s: &str,
) -> Result<&Il2CppObject<SystemString>, <&Il2CppObject<SystemString> as FromStr>::Err>
fn from_str( s: &str, ) -> Result<&Il2CppObject<SystemString>, <&Il2CppObject<SystemString> as FromStr>::Err>
Parses a string
s
to return a value of this type. Read moresource§impl Il2CppClassData for Il2CppObject<SystemString>
impl Il2CppClassData for Il2CppObject<SystemString>
const NAMESPACE: &'static str = "System"
const CLASS: &'static str = "String"
fn class() -> &'static Il2CppClass
fn class_mut() -> &'static mut Il2CppClass
fn instantiate() -> Result<&'static mut Self, Il2CppError>where
Self: Sized,
fn instantiate_as<T>() -> Result<&'static mut T, Il2CppError>where
T: 'static,
source§impl PartialEq for Il2CppObject<SystemString>
impl PartialEq for Il2CppObject<SystemString>
source§fn eq(&self, other: &Il2CppObject<SystemString>) -> bool
fn eq(&self, other: &Il2CppObject<SystemString>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.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