Skip to main content

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>, byref>)

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>, byref>): 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, index: Int) -> Reference[element_type, elt_is_mutable, lifetime, 0]

Gets a single element on the variadic list.

Args:

  • index (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.

__len__

__len__(self: Self) -> Int

Gets the size of the list.

Returns:

The number of elements on the variadic list.

__refitem__

__refitem__(self: Self, index: Int) -> Reference[element_type, elt_is_mutable, {(mutcast imm *[0,0]), lifetime}, 0]

Gets a single element on the variadic list.

Args:

  • index (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.

__iter__

__iter__(self: Self) -> _VariadicListMemIter[element_type, elt_is_mutable, lifetime, *[0,0]]

Iterate over the list.

Returns:

An iterator to the start of the list.