Mojo trait
RepresentableKeyElement
A trait composition for types which implement all requirements of dictionary keys and Stringable.
Implemented traits
AnyType
,
CollectionElement
,
Copyable
,
EqualityComparable
,
Hashable
,
KeyElement
,
Movable
,
Representable
Methods
__copyinit__
__copyinit__(inout self: T, existing: T, /)
Create a new instance of the value by copying an existing one.
Args:
- existing (
T
): The value to copy.
__moveinit__
__moveinit__(inout self: T, owned existing: T, /)
Create a new instance of the value by moving the value of another.
Args:
- existing (
T
): The value to move.
__eq__
__eq__(self: T, other: T) -> Bool
Define whether two instances of the object are equal to each other.
Args:
- other (
T
): Another instance of the same type.
Returns:
True if the instances are equal according to the type's definition of equality, False otherwise.
__ne__
__ne__(self: T, other: T) -> Bool
Define whether two instances of the object are not equal to each other.
Args:
- other (
T
): Another instance of the same type.
Returns:
True if the instances are not equal according to the type's definition of equality, False otherwise.
__hash__
__hash__(self: T) -> UInt
Return a 64-bit hash of the type's data.
Returns:
A 64-bit integer hash of this instance's data.
__repr__
__repr__(self: T) -> String
Get the string representation of the type instance, if possible, compatible with Mojo syntax.
Returns:
The string representation of the instance.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
😔 What went wrong?