pub struct U16Vec {
pub run_destructor: bool,
/* private fields */
}Fields§
§run_destructor: boolWhether to run the destructor on drop (prevents double-free when cloned to C)
Implementations§
Source§impl U16Vec
impl U16Vec
pub fn new() -> U16Vec
pub fn with_capacity(cap: usize) -> Self
pub const fn from_const_slice(input: &'static [u16]) -> Self
pub fn from_vec(input: Vec<u16>) -> Self
pub fn iter(&self) -> Iter<'_, u16>
pub fn ptr_as_usize(&self) -> usize
pub const fn len(&self) -> usize
pub const fn capacity(&self) -> usize
pub const fn is_empty(&self) -> bool
Sourcepub fn get(&self, index: usize) -> Option<&u16>
pub fn get(&self, index: usize) -> Option<&u16>
Returns a reference to the element at the given index (Rust-only, inline).
Sourcepub fn c_get(&self, index: usize) -> OptionU16
pub fn c_get(&self, index: usize) -> OptionU16
C-API compatible get function. Returns a copy of the element at the given index. Returns None if the index is out of bounds.
Sourcepub fn as_slice(&self) -> &[u16]
pub fn as_slice(&self) -> &[u16]
Returns the vec as a Rust slice (Rust-only, not C-API compatible).
Sourcepub fn as_c_slice(&self) -> U16VecSlice
pub fn as_c_slice(&self) -> U16VecSlice
Returns a C-compatible slice of the entire Vec.
Sourcepub fn as_c_slice_range(&self, start: usize, end: usize) -> U16VecSlice
pub fn as_c_slice_range(&self, start: usize, end: usize) -> U16VecSlice
Returns a C-compatible slice of a range within the Vec. If the range is out of bounds, it is clamped to the valid range.
Source§impl U16Vec
impl U16Vec
pub fn from_copy_on_write(input: Cow<'static, [u16]>) -> U16Vec
Sourcepub unsafe fn copy_from_ptr(ptr: *const u16, len: usize) -> Self
pub unsafe fn copy_from_ptr(ptr: *const u16, len: usize) -> Self
Copies elements from a C array pointer into a new Vec.
§Safety
ptrmust be valid for readinglenelements- The memory must be properly aligned for
$struct_type - The elements are cloned, so
$struct_typemust implementClone
Sourcepub fn clone_self(&self) -> Self
pub fn clone_self(&self) -> Self
NOTE: CLONES the memory if the memory is external or &’static Moves the memory out if the memory is library-allocated
Sourcepub fn into_library_owned_vec(self) -> Vec<u16>
pub fn into_library_owned_vec(self) -> Vec<u16>
NOTE: CLONES the memory if the memory is external or &’static Moves the memory out if the memory is library-allocated