Mojo trait
IntLike
The IntLike
trait is a tag for Int
or UInt
. This allows writing functions that works on either.
Implemented traits
Absable
,
AnyType
,
Ceilable
,
Floorable
,
Powable
,
Stringable
,
Truncable
,
UnknownDestructibility
,
Writable
Methods
__pow__
__pow__(self: _Self, exp: _Self) -> _Self
Return the value raised to the power of the given exponent.
Args:
- exp (
_Self
): The exponent value.
Returns:
The value of self
raised to the power of exp
.
__mlir_index__
__mlir_index__(self: _Self) -> index
Convert to index.
Returns:
The corresponding __mlir_type.index value.
__abs__
__abs__(self: _Self) -> _Self
Get the absolute value of this instance.
Returns:
The absolute value of the instance.
__ceil__
__ceil__(self: _Self) -> _Self
Return the ceiling of the Int value, which is itself.
Returns:
The Int value itself.
__floor__
__floor__(self: _Self) -> _Self
Return the floor of the Int value, which is itself.
Returns:
The Int value itself.
write_to
write_to[W: Writer](self: _Self, mut writer: W)
Formats the string representation of this type to the provided Writer.
Parameters:
- W (
Writer
): A type conforming to the Writable trait.
Args:
- writer (
W
): The type conforming toWritable
.
__str__
__str__(self: _Self) -> String
Get the string representation of the type.
Returns:
The string representation of the type.
__trunc__
__trunc__(self: _Self) -> _Self
Return the truncated Int value, which is itself.
Returns:
The Int value itself.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!