#[repr(C)]pub struct ListDef {
pub vtable: &'static ListVTable,
pub type_ops: Option<&'static ListTypeOps>,
pub t: &'static Shape,
}Expand description
Fields for list types
Fields§
§vtable: &'static ListVTablevtable for interacting with the list (can be type-erased/shared)
type_ops: Option<&'static ListTypeOps>Per-type operations that must be monomorphized (optional).
If None, uses the functions in vtable. If Some, these operations
are used instead of the corresponding vtable functions, allowing the
main vtable to be shared across all instantiations (e.g., one vtable
for all Vec<T>).
t: &'static Shapeshape of the items in the list
Implementations§
Source§impl ListDef
impl ListDef
Sourcepub const fn new(vtable: &'static ListVTable, t: &'static Shape) -> ListDef
pub const fn new(vtable: &'static ListVTable, t: &'static Shape) -> ListDef
Construct a ListDef from its vtable and element shape.
Sourcepub const fn with_type_ops(
vtable: &'static ListVTable,
type_ops: &'static ListTypeOps,
t: &'static Shape,
) -> ListDef
pub const fn with_type_ops( vtable: &'static ListVTable, type_ops: &'static ListTypeOps, t: &'static Shape, ) -> ListDef
Construct a ListDef with both shared vtable and per-T type operations.
Sourcepub fn init_in_place_with_capacity(
&self,
) -> Option<unsafe fn(PtrUninit, usize) -> PtrMut>
pub fn init_in_place_with_capacity( &self, ) -> Option<unsafe fn(PtrUninit, usize) -> PtrMut>
Returns the init_in_place_with_capacity function, checking type_ops first.
Sourcepub fn push(&self) -> Option<unsafe fn(PtrMut, PtrMut)>
pub fn push(&self) -> Option<unsafe fn(PtrMut, PtrMut)>
Returns the push function, checking type_ops first.
Sourcepub fn set_len(&self) -> Option<unsafe fn(PtrMut, usize)>
pub fn set_len(&self) -> Option<unsafe fn(PtrMut, usize)>
Returns the set_len function for direct-fill operations.
Sourcepub fn as_mut_ptr_typed(&self) -> Option<unsafe fn(PtrMut) -> *mut u8>
pub fn as_mut_ptr_typed(&self) -> Option<unsafe fn(PtrMut) -> *mut u8>
Returns the as_mut_ptr_typed function for direct-fill operations.
Sourcepub fn reserve(&self) -> Option<unsafe fn(PtrMut, usize)>
pub fn reserve(&self) -> Option<unsafe fn(PtrMut, usize)>
Returns the reserve function for direct-fill operations.
Sourcepub fn capacity(&self) -> Option<unsafe fn(PtrConst) -> usize>
pub fn capacity(&self) -> Option<unsafe fn(PtrConst) -> usize>
Returns the capacity function for direct-fill operations.
Sourcepub fn iter_vtable(&self) -> Option<&'static IterVTable<PtrConst>>
pub fn iter_vtable(&self) -> Option<&'static IterVTable<PtrConst>>
Returns the iterator vtable, checking type_ops first.
Returns None if no type_ops is set (no iterator support).