struct
VariadicListMem
A utility class to access variadic function arguments of memory-only types that may have ownership. It exposes references to the elements in a way that can be enumerated. Each element may be accessed with elt[]
.
Parameters
- element_type (
AnyType
): The type of the elements in the list. - elt_is_mutable (
i1
): True if the elements of the list are mutable for an inout or owned argument. - lifetime (
lifetime<elt_is_mutable>
): The reference lifetime of the underlying elements.
Aliases
reference_type = Reference[element_type, elt_is_mutable, lifetime, 0]
:
Fields
- value (
variadic<!lit.ref<:trait<@stdlib::@builtin::@anytype::@AnyType> element_type, mut=elt_is_mutable, lifetime>, borrow_in_mem>
): The underlying storage, a variadic list of references to elements of the given type.
Implemented traits
AnyType
,
Sized
Methods
__init__
__init__(inout self: Self, value: variadic<!lit.ref<:trait<_stdlib::_builtin::_anytype::_AnyType> element_type, mut=elt_is_mutable, lifetime>, borrow_in_mem>)
Constructs a VariadicList from a variadic argument type.
Args:
- value (
variadic<!lit.ref<:trait<_stdlib::_builtin::_anytype::_AnyType> element_type, mut=elt_is_mutable, lifetime>, borrow_in_mem>
): The variadic argument to construct the list with.
__init__(inout self: Self, inout value: variadic<!lit.ref<:trait<_stdlib::_builtin::_anytype::_AnyType> element_type, mut=elt_is_mutable, lifetime>, inout>)
Constructs a VariadicList from a variadic argument type.
Args:
- value (
variadic<!lit.ref<:trait<_stdlib::_builtin::_anytype::_AnyType> element_type, mut=elt_is_mutable, lifetime>, inout>
): The variadic argument to construct the list with.
__init__(inout self: Self, owned value: variadic<!lit.ref<:trait<_stdlib::_builtin::_anytype::_AnyType> element_type, mut=elt_is_mutable, lifetime>, owned_in_mem>)
Constructs a VariadicList from a variadic argument type.
Args:
- value (
variadic<!lit.ref<:trait<_stdlib::_builtin::_anytype::_AnyType> element_type, mut=elt_is_mutable, lifetime>, owned_in_mem>
): The variadic argument to construct the list with.
__moveinit__
__moveinit__(inout self: Self, owned existing: Self)
Moves constructor.
Args:
- existing (
Self
): The existing VariadicListMem.
__del__
__del__(owned self: Self)
Destructor that releases elements if owned.
__getitem__
__getitem__(self: Self, idx: Int) -> ref [{lifetime, (mutcast imm *[0,0])}] element_type
Gets a single element on the variadic list.
Args:
- idx (
Int
): The index of the element to access on the list.
Returns:
A low-level pointer to the element on the list corresponding to the given index.