Mojo 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
,
CollectionElementNew
,
Copyable
,
ExplicitlyCopyable
,
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.
__init__(inout self: Self, *, other: Self)
Copy an existing entry.
Args:
- βother (
Self
): The existing entry to copy.
reap_value
β
reap_value(owned self: Self) -> V
Take the value from an owned entry.
Returns:
The value of the entry.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
π What went wrong?