unity::system::string

Type Alias Il2CppString

source
pub type Il2CppString = Il2CppObject<SystemString>;
Expand description

A type alias for Il2CppObject<SystemString>.

Represents a C# string used by Il2Cpp.

Aliased Type§

struct Il2CppString {
    pub klass: &'static mut Il2CppClass,
    pub fields: SystemString,
    /* private fields */
}

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: SystemString

Implementations§

source§

impl Il2CppString

source

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
source

pub fn new_static(string: impl AsRef<str>) -> &'static mut Il2CppString

source

pub fn get_string(&self) -> Result<String, FromUtf16Error>

👎Deprecated: Use Il2CppString::to_string instead
source

pub fn to_string(&self) -> String

source

pub fn to_lowercase(&self) -> &mut Il2CppString

source

pub fn starts_with<'a>(&self, value: impl Into<&'a Il2CppString>) -> bool

source

pub fn contains<'a>(&self, value: impl Into<&'a Il2CppString>) -> bool

source

pub fn replace<'a>( &mut self, old_value: impl Into<&'a Il2CppString>, new_value: impl Into<&'a Il2CppString>, ) -> &mut Il2CppString

source

pub fn clone(&self) -> &Il2CppString

Provides a new instance of the Il2CppString, separate from the original.

source

pub fn clone_mut(&mut self) -> &mut Il2CppString

source

pub fn copy(&self) -> &Il2CppString

source

pub fn copy_mut(&mut self) -> &mut Il2CppString

source

pub fn get_hash_code(&self) -> i32

Trait Implementations§

source§

impl Display for Il2CppString

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: AsRef<str>> From<T> for &Il2CppString

source§

fn from(value: T) -> Self

Converts to this type from the input type.
source§

impl<T: AsRef<str>> From<T> for &mut Il2CppString

source§

fn from(value: T) -> Self

Converts to this type from the input type.
source§

impl FromStr for &Il2CppString

source§

type Err = ()

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Il2CppClassData for Il2CppString

source§

const NAMESPACE: &'static str = "System"

source§

const CLASS: &'static str = "String"

source§

fn class() -> &'static Il2CppClass

source§

fn class_mut() -> &'static mut Il2CppClass

source§

fn instantiate() -> Il2CppResult<&'static mut Self>
where Self: Sized,

source§

fn instantiate_as<T: 'static>() -> Il2CppResult<&'static mut T>

source§

impl PartialEq for Il2CppString

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.