Skip to main content

Il2cppArray

Struct Il2cppArray 

Source
pub struct Il2cppArray<T> {
    pub klass: *mut c_void,
    pub monitor: *mut c_void,
    pub bounds: *mut ArrayBounds,
    pub max_length: usize,
    /* private fields */
}

Fields§

§klass: *mut c_void

Pointer to the array class

§monitor: *mut c_void

Monitor for synchronization

§bounds: *mut ArrayBounds

Pointer to array bounds

§max_length: usize

Maximum length of the array

Implementations§

Source§

impl<T: Copy> Il2cppArray<T>

Source

pub fn get_data(&self) -> usize

Gets the address of the data array

§Returns
  • usize - The memory address where the array data begins
Source

pub fn get(&self, index: usize) -> T

Gets the element at the specified index

§Arguments
  • index - The index of the element to retrieve
§Returns
  • T - The element at the specified index
§Panics

Panics if the index is out of bounds.

Source

pub fn at(&self, index: usize) -> T

Alias for get

§Arguments
  • index - The index of the element to retrieve
§Returns
  • T - The element at the specified index
Source

pub fn set(&mut self, index: usize, value: T)

Sets the element at the specified index

§Arguments
  • index - The index where the value should be set
  • value - The value to set
§Panics

Panics if the index is out of bounds.

Source

pub fn get_pointer(&self) -> *const T

Gets a raw pointer to the data

§Returns
  • *const T - Pointer to the first element of the array
Source

pub fn insert(&mut self, arr: &[T], size: usize, index: usize)

Inserts elements from a slice into the array

§Arguments
  • arr - The slice of elements to insert
  • size - The number of elements to insert
  • index - The starting index in the array
Source

pub fn fill(&mut self, value: T)

Fills the array with a value

§Arguments
  • value - The value to fill the array with
Source

pub fn remove_at(&mut self, index: usize)

Removes an element at the specified index

Shifts subsequent elements to the left in place.

IL2CPP arrays are fixed-size, so this does not change max_length. The final slot is left as a duplicate of the former tail element.

§Arguments
  • index - The index of the element to remove
Source

pub fn remove_range(&mut self, index: usize, count: usize)

Removes a range of elements

Shifts subsequent elements to the left in place.

IL2CPP arrays are fixed-size, so this does not change max_length. Vacated tail slots are left duplicated from the previous tail values.

§Arguments
  • index - The starting index
  • count - The number of elements to remove
Source

pub fn remove_all(&mut self)

Removes all elements from the array

IL2CPP arrays are fixed-size managed objects, so clearing them by shrinking the header is unsupported. Overwrite elements explicitly if you need sentinel values.

Source

pub fn to_vector(&self) -> Vec<T>

Converts the array to a Rust Vec

§Returns
  • Vec<T> - A new vector containing the array elements
Source

pub fn new(class: &Class, size: usize) -> *mut Self

Creates a new array instance

§Arguments
  • class - The class of the elements
  • size - The size of the array
§Returns
  • *mut Self - A pointer to the new array

Auto Trait Implementations§

§

impl<T> Freeze for Il2cppArray<T>

§

impl<T> RefUnwindSafe for Il2cppArray<T>
where T: RefUnwindSafe,

§

impl<T> !Send for Il2cppArray<T>

§

impl<T> !Sync for Il2cppArray<T>

§

impl<T> Unpin for Il2cppArray<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Il2cppArray<T>

§

impl<T> UnwindSafe for Il2cppArray<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.