### get example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to use get to retrieve an element by index or a subslice by range, returning None if out of bounds. ```rust let v = [10, 40, 30]; assert_eq!(Some(&40), v.get(1)); assert_eq!(Some(&[10, 40][..]), v.get(0..2)); assert_eq!(None, v.get(3)); assert_eq!(None, v.get(0..4)); ``` -------------------------------- ### as_simd example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Example of using as_simd to split a slice into prefix, SIMD middle, and suffix, with a basic SIMD sum function. ```rust #![feature(portable_simd)] use core::simd::prelude::*; let short = &[1, 2, 3]; let (prefix, middle, suffix) = short.as_simd::<4>(); assert_eq!(middle, []); // Not enough elements for anything in the middle // They might be split in any possible way between prefix and suffix let it = prefix.iter().chain(suffix).copied(); assert_eq!(it.collect::>(), vec![1, 2, 3]); fn basic_simd_sum(x: &[f32]) -> f32 { use std::ops::Add; let (prefix, middle, suffix) = x.as_simd(); let sums = f32x4::from_array([ prefix.iter().copied().sum(), 0.0, 0.0, suffix.iter().copied().sum(), ]); let sums = middle.iter().copied().fold(sums, f32x4::add); sums.reduce_sum() } ``` -------------------------------- ### Example: iter.next() with Range Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html Example showing iteration over ranges, likely from a method returning an iterator of Range values. ```rust assert_eq!(iter.next(), Some(Range { start: 0, end: 0 })); assert_eq!(iter.next(), Some(Range { start: 1, end: 3 })); assert_eq!(iter.next(), Some(Range { start: 4, end: 4 })); assert_eq!(iter.next(), Some(Range { start: 5, end: 6 })); ``` -------------------------------- ### split example with first element matched Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html Example showing that if the first element is matched, an empty slice is the first item returned by the iterator. ```rust let slice = [10, 40, 33]; let mut iter = slice.split(|num| num % 3 == 0); assert_eq!(iter.next().unwrap(), &[10, 40]); assert_eq!(iter.next().unwrap(), &[]); assert!(iter.next().is_none()); ``` -------------------------------- ### partition_point range example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to find the range of matching items using partition_point, and how to insert an item while maintaining sort order. ```rust let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; let low = s.partition_point(|x| x < &1); assert_eq!(low, 1); let high = s.partition_point(|x| x <= &1); assert_eq!(high, 5); let r = s.binary_search(&1); assert!((low..high).contains(&r.unwrap())); assert!(s[..low].iter().all(|&x| x < 1)); assert!(s[low..high].iter().all(|&x| x == 1)); assert!(s[high..].iter().all(|&x| x > 1)); // For something not found, the "range" of equal items is empty assert_eq!(s.partition_point(|x| x < &11), 9); assert_eq!(s.partition_point(|x| x <= &11), 9); assert_eq!(s.binary_search(&11), Err(9)); ``` -------------------------------- ### split_off example: split off starting from third element Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows using split_off with a range starting at index 2 to remove the tail of the slice. ```rust let mut slice: &[_] = &['a', 'b', 'c', 'd']; let mut tail = slice.split_off(2..).unwrap(); assert_eq!(slice, &['a', 'b']); assert_eq!(tail, &['c', 'd']); ``` -------------------------------- ### binary_search example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=std%3A%3Avec Demonstrates binary_search on a sorted slice, showing Ok and Err results. The example also shows using partition_point to find the range of matching items and inserting an element while maintaining sort order. ```rust let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; assert_eq!(s.binary_search(&13), Ok(9)); assert_eq!(s.binary_search(&4), Err(7)); assert_eq!(s.binary_search(&100), Err(13)); let r = s.binary_search(&1); assert!(match r { Ok(1..=4) => true, _ => false, }); ``` ```rust let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; let low = s.partition_point(|x| x < &1); assert_eq!(low, 1); let high = s.partition_point(|x| x <= &1); assert_eq!(high, 5); let r = s.binary_search(&1); assert!((low..high).contains(&r.unwrap())); assert!(s[..low].iter().all(|&x| x < 1)); assert!(s[low..high].iter().all(|&x| x == 1)); assert!(s[high..].iter().all(|&x| x > 1)); // For something not found, the "range" of equal items is empty assert_eq!(s.partition_point(|x| x < &11), 9); assert_eq!(s.partition_point(|x| x <= &11), 9); assert_eq!(s.binary_search(&11), Err(9)); ``` ```rust let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; let num = 42; let idx = s.partition_point(|&x| x <= num); // If `num` is unique, `s.partition_point(|&x| x < num)` (with `<`) is equivalent to // `s.binary_search(&num).unwrap_or_else(|x| x)`, but using `<=` will allow `insert` // to shift less elements. s.insert(idx, num); assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); ``` -------------------------------- ### split_off_mut example: split off starting from third element Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows using split_off_mut with a range starting at index 2 to remove the tail of a mutable slice. ```rust let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd']; let mut tail = slice.split_off_mut(2..).unwrap(); assert_eq!(slice, &mut ['a', 'b']); assert_eq!(tail, &mut ['c', 'd']); ``` -------------------------------- ### TutorialParam Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.TutorialParam.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E The TutorialParam struct implements the SoloParam trait, allowing it to be used with SoloParamRepository::get and similar methods to load parameter data. ```APIDOC ## TutorialParam ### Description The TutorialParam parameter. This can be used with SoloParamRepository::get and similar methods to load parameter data. ### Struct Definition ```rust pub struct TutorialParam; ``` ### Trait Implementations #### SoloParam for TutorialParam - **NAME**: `const NAME: &'static str = "TutorialParam"` - The parameter name. This corresponds to `ParamResCap.res_cap.name` and `FD4ParamResCap.res_cap.name`, not to `ParamFile::struct_name` and `ParamDef::NAME`. - **INDEX**: `const INDEX: u32 = 180` - The index of this parameter in SoloParamRepository. - **StructType**: `type StructType = TUTORIAL_PARAM_ST` - The type of the data that this parameter contains. ### Usage This struct can be used with `SoloParamRepository::get` and similar methods to load parameter data. ``` -------------------------------- ### as_chunks_mut example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Splits a mutable slice into N-element arrays starting from the beginning, returning a mutable remainder. The example shows modifying the remainder and each chunk. ```rust let v = &mut [0, 0, 0, 0, 0]; let mut count = 1; let (chunks, remainder) = v.as_chunks_mut(); remainder[0] = 9; for chunk in chunks { *chunk = [count; 2]; count += 1; } assert_eq!(v, &[9, 1, 1, 2, 2]); ``` -------------------------------- ### as_rchunks example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Splits a slice into N-element arrays starting from the end, returning a remainder slice. The example shows a slice of characters split into 2-element chunks with a remainder of one element. ```rust let slice = ['l', 'o', 'r', 'e', 'm']; let (remainder, chunks) = slice.as_rchunks(); assert_eq!(remainder, &['l']); assert_eq!(chunks, &[['o', 'r'], ['e', 'm']]); ``` -------------------------------- ### wait_for_system_init Source: https://docs.rs/eldenring/latest/eldenring/util/system/fn.wait_for_system_init.html Documentation for the wait_for_system_init function in the eldenring crate. ```APIDOC ## wait_for_system_init ### Description Waits for the system to finish initializing by waiting for a global hInstance to be populated for CSWindow. This happens after the CRT init and after duplicate instance checks. ### Function Signature ```rust pub fn wait_for_system_init( module: &Program<'_>, timeout: Duration, ) -> Result<(), SystemInitError> ``` ### Parameters - **module** (`&Program<'_>`) - Required - The program module. - **timeout** (`Duration`) - Required - The maximum time to wait for initialization. ### Returns - `Result<(), SystemInitError>` - Returns `Ok(())` if the system initialized successfully, or an `Err` with a `SystemInitError` if initialization fails or times out. ``` -------------------------------- ### Example: subslice_range basic usage Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to use subslice_range to get the range of indices that a subslice points to. ```rust use core::range::Range; let nums = &[0, 5, 10, 0, 0, 5]; let mut iter = nums .split(|t| *t == 0) .map(|n| nums.subslice_range(n).unwrap()); ``` -------------------------------- ### Example for slice first method Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates `first` returning the first element or None for an empty slice. ```rust let v = [10, 40, 30]; assert_eq!(Some(&10), v.first()); let w: &[i32] = &[]; assert_eq!(None, w.first()); ``` -------------------------------- ### get_mut example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to use get_mut to get a mutable reference to an element, returning None if out of bounds. ```rust let x = &mut [0, 1, 2]; if let Some(elem) = x.get_mut(1) { *elem = 42; } assert_eq!(x, &[0, 42, 2]); ``` -------------------------------- ### partition_point example: assert partition index Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Example showing how to use partition_point to find the index where the predicate switches from true to false, with assertions on the resulting partition. ```rust assert_eq!(i, 4); assert!(v[..i].iter().all(|&x| x < 5)); assert!(v[i..].iter().all(|&x| !(x < 5))); ``` -------------------------------- ### split_off_last_mut example: remove and mutate last element Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows using split_off_last_mut to get a mutable reference to the last element and modify it. ```rust let mut slice: &mut [_] = &mut ['a', 'b', 'c']; let last = slice.split_off_last_mut().unwrap(); *last = 'd'; ``` -------------------------------- ### Insert with partition_point example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to insert an item into a sorted vector while maintaining sort order using partition_point. ```rust let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; let num = 42; let idx = s.partition_point(|x| x <= num); // If `num` is unique, `s.partition_point(|&x| x < num)` (with `<`) is equivalent to // `s.binary_search(&num).unwrap_or_else(|x| x)`, but using `<=` will allow `insert` // to shift less elements. s.insert(idx, num); assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); ``` -------------------------------- ### split_off_first_mut example: remove and mutate first element Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows using split_off_first_mut to get a mutable reference to the first element and modify it. ```rust let mut slice: &mut [_] = &mut ['a', 'b', 'c']; let first = slice.split_off_first_mut().unwrap(); *first = 'd'; assert_eq!(slice, &['b', 'c']); assert_eq!(first, &'d'); ``` -------------------------------- ### Example for slice split_first method Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates `split_first` returning the first element and the rest. ```rust let x = &[0, 1, 2]; if let Some((first, elements)) = x.split_first() { assert_eq!(first, &0); assert_eq!(elements, &[1, 2]); } ``` -------------------------------- ### starts_with example: check prefix Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Returns true if the slice starts with the given needle. Always returns true for an empty needle. ```rust let v = [10, 40, 30]; assert!(v.starts_with(&[10])); assert!(v.starts_with(&[10, 40])); assert!(v.starts_with(&v)); assert!(!v.starts_with(&[50])); assert!(!v.starts_with(&[10, 50])); ``` ```rust let v = &[10, 40, 30]; assert!(v.starts_with(&[])); let v: &[u8] = &[]; assert!(v.starts_with(&[])); ``` -------------------------------- ### get_unchecked example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to use unsafe get_unchecked to get a reference without bounds checking. Calling with an out-of-bounds index is undefined behavior. ```rust let x = &[1, 2, 4]; unsafe { assert_eq!(x.get_unchecked(1), &2); } ``` -------------------------------- ### wait_for_system_init Source: https://docs.rs/eldenring/latest/eldenring/util/system/fn.wait_for_system_init.html?search= Waits for the system to finish initializing by waiting for a global hInstance to be populated for CSWindow. This happens after the CRT init and after duplicate instance checks. ```APIDOC ## wait_for_system_init ### Description Waits for the system to finish initializing by waiting for a global hInstance to be populated for CSWindow. This happens after the CRT init and after duplicate instance checks. ### Function Signature ```rust pub fn wait_for_system_init( module: &Program<'_>, timeout: Duration, ) -> Result<(), SystemInitError> ``` ### Parameters - **module** (&Program<'_>) - Required - A reference to the program module. - **timeout** (Duration) - Required - The maximum time to wait for initialization. ### Returns - **Result<(), SystemInitError>** - Returns Ok(()) if initialization completes within the timeout, or an error if it fails or times out. ``` -------------------------------- ### last_chunk_mut example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to use last_chunk_mut to get a mutable reference to the last N items. Returns None if the slice is shorter than N. ```rust let x = &mut [0, 1, 2]; if let Some(last) = x.last_chunk_mut::<2>() { last[0] = 10; last[1] = 20; } assert_eq!(x, &[0, 10, 20]); assert_eq!(None, x.last_chunk_mut::<4>()); ``` -------------------------------- ### wait_for_system_init Source: https://docs.rs/eldenring/latest/eldenring/util/system/fn.wait_for_system_init.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Waits for the system to finish initializing by waiting for a global hInstance to be populated for CSWindow. This happens after the CRT init and after duplicate instance checks. ```APIDOC ## wait_for_system_init ### Description Waits for the system to finish initializing by waiting for a global hInstance to be populated for CSWindow. This happens after the CRT init and after duplicate instance checks. ### Function Signature ```rust pub fn wait_for_system_init( module: &Program<'_>, timeout: Duration, ) -> Result<(), SystemInitError> ``` ### Parameters - **module** (`&Program<'_>`) - Required - A reference to the program module. - **timeout** (`Duration`) - Required - The maximum time to wait for initialization. ### Return Value - `Result<(), SystemInitError>` - Returns `Ok(())` if initialization completes successfully, or an `Err` with a `SystemInitError` on failure. ``` -------------------------------- ### TUTORIAL_PARAM_ST Methods Source: https://docs.rs/eldenring/latest/eldenring/param/struct.TUTORIAL_PARAM_ST.html Getter and setter methods for the TUTORIAL_PARAM_ST struct fields. ```APIDOC ## TUTORIAL_PARAM_ST Methods ### Description Provides getter and setter methods for the fields of the TUTORIAL_PARAM_ST struct. ### Methods #### disable_param_nt - **Signature**: `pub fn disable_param_nt(&self) -> bool` - **Description**: Returns the value of the `disable_param_nt` field. #### set_disable_param_nt - **Signature**: `pub fn set_disable_param_nt(&mut self, value: bool)` - **Description**: Sets the value of the `disable_param_nt` field. #### menu_type - **Signature**: `pub fn menu_type(&self) -> u8` - **Description**: Returns the value of the `menu_type` field. #### set_menu_type - **Signature**: `pub fn set_menu_type(&mut self, value: u8)` - **Description**: Sets the value of the `menu_type` field. #### trigger_type - **Signature**: `pub fn trigger_type(&self) -> u8` - **Description**: Returns the value of the `trigger_type` field. #### set_trigger_type - **Signature**: `pub fn set_trigger_type(&mut self, value: u8)` - **Description**: Sets the value of the `trigger_type` field. #### repeat_type - **Signature**: `pub fn repeat_type(&self) -> u8` - **Description**: Returns the value of the `repeat_type` field. #### set_repeat_type - **Signature**: `pub fn set_repeat_type(&mut self, value: u8)` - **Description**: Sets the value of the `repeat_type` field. #### image_id - **Signature**: `pub fn image_id(&self) -> u16` - **Description**: Returns the value of the `image_id` field. #### set_image_id - **Signature**: `pub fn set_image_id(&mut self, value: u16)` - **Description**: Sets the value of the `image_id` field. #### unlock_event_flag_id - **Signature**: `pub fn unlock_event_flag_id(&self) -> u32` - **Description**: Returns the value of the `unlock_event_flag_id` field. #### set_unlock_event_flag_id - **Signature**: `pub fn set_unlock_event_flag_id(&mut self, value: u32)` - **Description**: Sets the value of the `unlock_event_flag_id` field. #### text_id - **Signature**: `pub fn text_id(&self) -> i32` - **Description**: Returns the value of the `text_id` field. #### set_text_id - **Signature**: `pub fn set_text_id(&mut self, value: i32)` - **Description**: Sets the value of the `text_id` field. #### display_min_time - **Signature**: `pub fn display_min_time(&self) -> f32` - **Description**: Returns the value of the `display_min_time` field. #### set_display_min_time - **Signature**: `pub fn set_display_min_time(&mut self, value: f32)` - **Description**: Sets the value of the `display_min_time` field. #### display_time - **Signature**: `pub fn display_time(&self) -> f32` - **Description**: Returns the value of the `display_time` field. #### set_display_time - **Signature**: `pub fn set_display_time(&mut self, value: f32)` - **Description**: Sets the value of the `display_time` field. ``` -------------------------------- ### Example: element_offset returning None with unaligned element Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates that element_offset returns None when the element does not point to the start of an element within the slice. ```rust let arr: &[[u32; 2]] = &[[0, 1], [2, 3]]; let flat_arr: &[u32] = arr.as_flattened(); let ok_elm: &[u32; 2] = flat_arr[0..2].try_into().unwrap(); let weird_elm: &[u32; 2] = flat_arr[1..3].try_into().unwrap(); assert_eq!(ok_elm, &[0, 1]); assert_eq!(weird_elm, &[1, 2]); assert_eq!(arr.element_offset(ok_elm), Some(0)); // Points to element 0 assert_eq!(arr.element_offset(weird_elm), None); // Points between element 0 and 1 ``` -------------------------------- ### get_unchecked_mut example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to use unsafe get_unchecked_mut to get a mutable reference without bounds checking. Calling with an out-of-bounds index is undefined behavior. ```rust let x = &mut [1, 2, 4]; unsafe { let elem = x.get_unchecked_mut(1); *elem = 13; } assert_eq!(x, &[1, 13, 4]); ``` -------------------------------- ### impl<'sub> TryFrom<&'sub CSGaitemIns> for &'sub CSWepGaitemIns Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.CSGaitemIns.html?search=u32+-%3E+bool Fallible conversion from CSGaitemIns reference to CSWepGaitemIns reference. ```APIDOC ## impl<'sub> TryFrom<&'sub CSGaitemIns> for &'sub CSWepGaitemIns ### Description Attempts to convert a shared reference to CSGaitemIns into a shared reference to CSWepGaitemIns. ### Type Error - **TryFromSuperclassError** - The type returned in the event of a conversion error. ### Method `fn try_from(value: &'sub CSGaitemIns) -> Result` ### Parameters - **value** (&'sub CSGaitemIns) - The reference to convert. ### Returns - **Result** - The converted reference or an error. ``` -------------------------------- ### TryFrom<&FD4ResRep> for &MsbRepository Source: https://docs.rs/eldenring/latest/eldenring/fd4/struct.FD4ResRep.html?search=u32+-%3E+bool Conversion from a reference to FD4ResRep to a reference to MsbRepository. ```APIDOC ## TryFrom<&FD4ResRep> for &MsbRepository ### Description Attempts to convert a reference to FD4ResRep into a reference to MsbRepository. ### Associated Types - **Error** = TryFromSuperclassError - The type returned in the event of a conversion error. ### Methods #### fn try_from(value: &'sub FD4ResRep) -> Result Performs the conversion. ``` -------------------------------- ### split_last_chunk example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to use split_last_chunk to get a reference to the last N items and the remaining slice. Returns None if the slice is shorter than N. ```rust let x = &[0, 1, 2]; if let Some((elements, last)) = x.split_last_chunk::<2>() { assert_eq!(elements, &[0]); assert_eq!(last, &[1, 2]); } assert_eq!(None, x.split_last_chunk::<4>()); ``` -------------------------------- ### split_off_mut example: split off first three elements Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates using split_off_mut to remove the first three elements of a mutable slice and get a mutable reference to them. ```rust let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd']; let mut first_three = slice.split_off_mut(..3).unwrap(); assert_eq!(slice, &mut ['d']); assert_eq!(first_three, &mut ['a', 'b', 'c']); ``` -------------------------------- ### QuickMatchSettings Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.QuickMatchSettings.html Documentation for the QuickMatchSettings struct and its methods. ```APIDOC ## QuickMatchSettings ### Description Represents quick match settings for Elden Ring, wrapping a raw u32 bitfield. Provides methods to query specific settings. ### Constructor - `pub struct QuickMatchSettings(pub u32);` ### Methods #### `spirit_ashes_allowed` - **Signature**: `pub const fn spirit_ashes_allowed(self) -> bool` - **Description**: Returns whether spirit ashes summoning is allowed in this gamemode. #### `is_brawl_mode` - **Signature**: `pub const fn is_brawl_mode(self) -> bool` - **Description**: Returns whether this gamemode is brawl mode. #### `is_team_mode` - **Signature**: `pub const fn is_team_mode(self) -> bool` - **Description**: Returns whether this gamemode is team-based. #### `is_allies_password_mode` - **Signature**: `pub const fn is_allies_password_mode(self) -> bool` - **Description**: Returns whether this gamemode uses a password to match with allies, as opposed to a password-protected lobby where password doesn't affect team composition. #### `match_size` - **Signature**: `pub const fn match_size(self) -> QuickMatchSize` - **Description**: Returns the match size for this gamemode. ### Trait Implementations - `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` are implemented. ### Auto Traits - `Freeze`, `RefUnwindSafe`, `Send`, `Sync`, `Unpin`, `UnsafeUnpin`, `UnwindSafe` are automatically implemented. ### Blanket Implementations - Standard blanket implementations from the standard library are provided. ``` -------------------------------- ### BasicString Methods (Construction and Capacity) Source: https://docs.rs/eldenring/latest/eldenring/from_net/type.FNString.html?search=u32+-%3E+bool Methods for constructing and managing the string's capacity. ```APIDOC ## BasicString Methods (Construction and Capacity) ### Description Methods for constructing and managing the string's capacity. ### Methods #### new_in ```rust pub fn new_in(allocator: A) -> BasicString ``` Creates an empty string backed by `allocator`. Equivalent to `std::basic_string()` with a custom allocator. Starts in SSO mode with `capacity = SSO_CAP - 1`. #### from_units_in ```rust pub fn from_units_in(chars: impl AsRef<[C]>, allocator: A) -> BasicString ``` Creates a string from a slice of code units, allocating if the slice does not fit in the SSO buffer. Equivalent to `std::basic_string(ptr, len, allocator)`. #### assign ```rust pub fn assign(&mut self, units: impl AsRef<[C]>) ``` Assigns the given code units to the string. #### len ```rust pub fn len(&self) -> usize ``` Returns the number of code units (not bytes, not Unicode scalar values). #### is_empty ```rust pub fn is_empty(&self) -> bool ``` Returns `true` if the string is empty. #### capacity ```rust pub fn capacity(&self) -> usize ``` Returns the allocated capacity in code units, excluding the NUL terminator. #### as_ptr ```rust pub fn as_ptr(&self) -> *const C ``` Returns a pointer to the first code unit, equivalent to `std::string::c_str()`. #### as_mut_ptr ```rust pub fn as_mut_ptr(&mut self) -> *mut C ``` Returns a mutable raw pointer to the first code unit. #### as_code_units ```rust pub fn as_code_units(&self) -> &[C] ``` Returns the string data as a slice of code units. #### as_mut_code_units ```rust pub fn as_mut_code_units(&mut self) -> &mut [C] ``` Returns the string data as a mutable slice of code units. #### as_bytes ```rust pub fn as_bytes(&self) -> &[u8] ``` Returns the string data as a byte slice. #### as_bytes_mut ```rust pub fn as_bytes_mut(&mut self) -> &mut [u8] ``` Returns the string data as a mutable byte slice. #### reserve ```rust pub fn reserve(&mut self, additional: usize) ``` Ensures capacity for at least `additional` more code units without reallocation. Does not count the NUL terminator. Same as `String::reserve`. #### push ```rust pub fn push(&mut self, c: C) ``` Appends a single code unit. Same as `String::push`. #### push_slice ```rust pub fn push_slice(&mut self, other: impl AsRef<[C]>) ``` Appends a slice of code units. Same as `String::push_str`. #### truncate ```rust pub fn truncate(&mut self, new_len: usize) ``` Shortens the string to `new_len` code units, dropping the rest. Panics if `new_len > len()`. Does not reallocate. Same as `String::truncate`. #### clear ```rust pub fn clear(&mut self) ``` Sets length to 0 without freeing the buffer. Same as `String::clear`. ``` -------------------------------- ### split_last_chunk_mut example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to use split_last_chunk_mut to get a mutable reference to the last N items and the remaining slice. Returns None if the slice is shorter than N. ```rust let x = &mut [0, 1, 2]; if let Some((elements, last)) = x.split_last_chunk_mut::<2>() { last[0] = 3; last[1] = 4; elements[0] = 5; } assert_eq!(x, &[5, 3, 4]); assert_eq!(None, x.split_last_chunk_mut::<4>()); ``` -------------------------------- ### split_first_chunk_mut example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to use split_first_chunk_mut to get a mutable reference to the first N items and the remaining slice. Returns None if the slice is shorter than N. ```rust let x = &mut [0, 1, 2]; if let Some((first, elements)) = x.split_first_chunk_mut::<2>() { first[0] = 3; first[1] = 4; elements[0] = 5; } assert_eq!(x, &[3, 4, 5]); assert_eq!(None, x.split_first_chunk_mut::<4>()); ``` -------------------------------- ### Example for slice split_first_chunk method Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates `split_first_chunk` returning an array reference to the first N items and the rest. ```rust let x = &[0, 1, 2]; if let Some((first, elements)) = x.split_first_chunk::<2>() { assert_eq!(first, &[0, 1]); assert_eq!(elements, &[2]); } assert_eq!(None, x.split_first_chunk::<4>()); ``` -------------------------------- ### as_chunks example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search= Demonstrates the as_chunks method on a slice. It splits the slice into chunks of size 2 and a remainder, asserting the resulting chunks and remainder. ```rust let slice = ['l', 'o', 'r', 'e', 'm']; let (chunks, remainder) = slice.as_chunks(); assert_eq!(chunks, &[['l', 'o'], ['r', 'e']]); assert_eq!(remainder, &['m']); ``` -------------------------------- ### iter() - Iterate over slice elements Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Returns an iterator over the slice, yielding all items from start to end. The example shows iterating over a slice of integers and asserting each yielded value. ```rust let x = &[1, 2, 4]; let mut iterator = x.iter(); assert_eq!(iterator.next(), Some(&1)); assert_eq!(iterator.next(), Some(&2)); assert_eq!(iterator.next(), Some(&4)); assert_eq!(iterator.next(), None); ``` -------------------------------- ### last_chunk example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to use last_chunk to get a reference to the last N items. Returns None if the slice is shorter than N. Note that N=0 returns Some(&[]) for an empty slice. ```rust let u = [10, 40, 30]; assert_eq!(Some(&[40, 30]), u.last_chunk::<2>()); let v: &[i32] = &[10]; assert_eq!(None, v.last_chunk::<2>()); let w: &[i32] = &[]; assert_eq!(Some(&[]), w.last_chunk::<0>()); ``` -------------------------------- ### QuickMatchSettings methods Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.QuickMatchSettings.html?search=std%3A%3Avec Methods to query properties of the quick match settings. ```APIDOC ## QuickMatchSettings ### Description Struct representing quick match settings, wrapping a u32 value. ### Tuple Fields - `0: u32` - The raw settings value. ### Methods #### `spirit_ashes_allowed(self) -> bool` - **Description**: Whether or not this gamemode allows spirit ashes summoning. #### `is_brawl_mode(self) -> bool` - **Description**: Whether or not this gamemode is brawl mode. #### `is_team_mode(self) -> bool` - **Description**: Whether or not this gamemode is team-based. #### `is_allies_password_mode(self) -> bool` - **Description**: Whether or not this gamemode uses password for match you with your allies. Compared to just being password protected lobby where password doesn’t affect team composition. #### `match_size(self) -> QuickMatchSize` - **Description**: Returns the match size. ### Trait Implementations - `Clone` - `Copy` - `Debug` - `Eq` - `Hash` - `PartialEq` - `StructuralPartialEq` ``` -------------------------------- ### new_in Source: https://docs.rs/eldenring/latest/eldenring/from_net/type.FNString.html?search= Creates an empty string backed by `allocator`. Equivalent to `std::basic_string()` with a custom allocator. Starts in SSO mode with `capacity = SSO_CAP - 1`. ```APIDOC ## new_in ### Description Creates an empty string backed by `allocator`. Equivalent to `std::basic_string()` with a custom allocator. Starts in SSO mode with `capacity = SSO_CAP - 1`. ### Method `pub fn new_in(allocator: A) -> BasicString` ### Parameters - **allocator** (A) - Required - The allocator to use. ### Returns - `BasicString` - A new empty string. ``` -------------------------------- ### as_rchunks_mut example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html Splits a mutable slice into N-element chunks starting from the end, returning a remainder slice and a chunks slice. The remainder length equals slice.len() % N. Panics if N is zero. ```rust let v = &mut [0, 0, 0, 0, 0]; let mut count = 1; let (remainder, chunks) = v.as_rchunks_mut(); remainder[0] = 9; for chunk in chunks { *chunk = [count; 2]; count += 1; } assert_eq!(v, &[9, 1, 1, 2, 2]); ``` -------------------------------- ### as_chunks_mut example Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html Splits a mutable slice into N-element chunks starting from the beginning, returning a chunks slice and a remainder slice. The remainder length equals slice.len() % N. Panics if N is zero. ```rust let v = &mut [0, 0, 0, 0, 0]; let mut count = 1; let (chunks, remainder) = v.as_chunks_mut(); remainder[0] = 9; for chunk in chunks { *chunk = [count; 2]; count += 1; } assert_eq!(v, &[1, 1, 2, 2, 9]); ``` -------------------------------- ### Example for slice first_chunk method Source: https://docs.rs/eldenring/latest/eldenring/cs/struct.AutoInvadePointBlockEntry.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates `first_chunk` returning an array reference to the first N items. ```rust let u = [10, 40, 30]; assert_eq!(Some(&[10, 40]), u.first_chunk::<2>()); let v: &[i32] = &[10]; assert_eq!(None, v.first_chunk::<2>()); let w: &[i32] = &[]; assert_eq!(Some(&[]), w.first_chunk::<0>()); ```