Skip to main content

struct

DictEntry

Store a key-value pair entry inside a dictionary.

Parameters

  • K (KeyElement): The key type of the dict. Must be Hashable+EqualityComparable.
  • V (CollectionElement): The value type of the dict.

Fields

  • hash (Int): key.__hash__(), stored so hashing isn't re-computed during dict lookup.
  • key (K): The unique key for the entry.
  • value (V): The value associated with the key.

Implemented traits

AnyType, CollectionElement, Copyable, Movable

Methods

__init__

__init__(inout self: Self, /, owned key: K, owned value: V)

Create an entry from a key and value, computing the hash.

Args:

  • key (K): The key of the entry.
  • value (V): The value of the entry.