Mojo struct
ListLiteral
The type of a literal heterogeneous list expression.
A list consists of zero or more values, separated by commas.
Parameters
- *Ts (
Movable
): The type of the elements.
Fields
- storage (
Tuple[Ts]
): The underlying storage for the list.
Implemented traits
AnyType
,
Movable
,
Sized
Methods
__init__
__init__(inout self: Self, owned *args: *Ts)
Construct the list literal from the given values.
Args:
- *args (
*Ts
): The init values.
__moveinit__
__moveinit__(inout self: Self, owned existing: Self)
Move construct the list.
Args:
- existing (
Self
): The value to move from.
__contains__
__contains__[T: EqualityComparable](self: Self, value: T) -> Bool
Determines if a given value exists in the ListLiteral.
Parameters:
- T (
EqualityComparable
): The type of the value to search for. Must implement theEqualityComparable
trait.
Args:
- value (
T
): The value to search for in the ListLiteral.
Returns:
True if the value is found in the ListLiteral, False otherwise.
__len__
__len__(self: Self) -> Int
Get the list length.
Returns:
The length of this ListLiteral.