#[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) -> Self
pub const fn new(vtable: &'static ListVTable, t: &'static Shape) -> Self
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,
) -> Self
pub const fn with_type_ops( vtable: &'static ListVTable, type_ops: &'static ListTypeOps, t: &'static Shape, ) -> Self
Construct a ListDef with both shared vtable and per-T type operations.
Sourcepub fn init_in_place_with_capacity(
&self,
) -> Option<ListInitInPlaceWithCapacityFn>
pub fn init_in_place_with_capacity( &self, ) -> Option<ListInitInPlaceWithCapacityFn>
Returns the init_in_place_with_capacity function, checking type_ops first.
Sourcepub fn push(&self) -> Option<ListPushFn>
pub fn push(&self) -> Option<ListPushFn>
Returns the push function, checking type_ops first.
Sourcepub fn set_len(&self) -> Option<ListSetLenFn>
pub fn set_len(&self) -> Option<ListSetLenFn>
Returns the set_len function for direct-fill operations.
Sourcepub fn as_mut_ptr_typed(&self) -> Option<ListAsMutPtrTypedFn>
pub fn as_mut_ptr_typed(&self) -> Option<ListAsMutPtrTypedFn>
Returns the as_mut_ptr_typed function for direct-fill operations.
Sourcepub fn reserve(&self) -> Option<ListReserveFn>
pub fn reserve(&self) -> Option<ListReserveFn>
Returns the reserve function for direct-fill operations.
Sourcepub fn capacity(&self) -> Option<ListCapacityFn>
pub fn capacity(&self) -> Option<ListCapacityFn>
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).