Skip to main content
Log in

Mojo trait

Testable

A trait that a struct should conform to if we do equality testing on it.

Implemented traits

AnyType, EqualityComparable, Stringable, UnknownDestructibility

Methods

__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.

__str__

__str__(self: _Self) -> String

Get the string representation of the type.

Returns:

The string representation of the type.