Mojo trait
ComparableCollectionElement
This trait denotes a trait composition of the CollectionElement
and Comparable
traits.
This is useful to have as a named entity since Mojo does not
currently support anonymous trait compositions to constrain
on CollectionElement & Comparable
in the parameter.
Implemented traits
AnyType
,
CollectionElement
,
Comparable
,
Copyable
,
EqualityComparable
,
Movable
,
UnknownDestructibility
Methods
__copyinit__
__copyinit__(out self: _Self, existing: _Self, /)
Create a new instance of the value by copying an existing one.
Args:
- existing (
_Self
): The value to copy.
__moveinit__
__moveinit__(out self: _Self, owned existing: _Self, /)
Create a new instance of the value by moving the value of another.
Args:
- existing (
_Self
): The value to move.
__lt__
__lt__(self: _Self, rhs: _Self) -> Bool
Define whether self
is less than rhs
.
Args:
- rhs (
_Self
): The right hand side of the comparison.
Returns:
True if self
is less than rhs
.
__le__
__le__(self: _Self, rhs: _Self) -> Bool
Define whether self
is less than or equal to rhs
.
Args:
- rhs (
_Self
): The right hand side of the comparison.
Returns:
True if self
is less than or equal to rhs
.
__eq__
__eq__(self: _Self, other: _Self) -> Bool
Define whether two instances of the object are equal to each other.
Args:
- other (
_Self
): 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: _Self, other: _Self) -> Bool
Define whether two instances of the object are not equal to each other.
Args:
- other (
_Self
): Another instance of the same type.
Returns:
True if the instances are not equal according to the type's definition of equality, False otherwise.
__gt__
__gt__(self: _Self, rhs: _Self) -> Bool
Define whether self
is greater than rhs
.
Args:
- rhs (
_Self
): The right hand side of the comparison.
Returns:
True if self
is greater than rhs
.
__ge__
__ge__(self: _Self, rhs: _Self) -> Bool
Define whether self
is greater than or equal to rhs
.
Args:
- rhs (
_Self
): The right hand side of the comparison.
Returns:
True if self
is greater than or equal to rhs
.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!