container[index]) where the input type is mutated.
This trait should be implemented when you want to implement indexing operations on a type that’s
mutated by a read access. This is useful for any type depending on a Felt252Dict, where
dictionary accesses are modifying the data structure itself.
container[index] is syntactic sugar for container.index(index).
Signature
Examples
The following example implementsIndex on a Stack type. This Stack is implemented based on
a Felt252Dict, where dictionary accesses are modifying the dictionary itself. As such, we
must implement the Index trait instead of the IndexView trait.
Trait functions
index
Performs the indexing (container[index]) operation.