Expand description
Useful type operators that are not defined in core::ops
.
Traitsยง
- Abs
- A type operator that returns the absolute value.
- Cmp
- A type operator for comparing
Self
andRhs
. It provides a similar functionality to the functioncore::cmp::Ord::cmp
but for types. - Gcd
- A type operator that computes the greatest common divisor of
Self
andRhs
. - IsEqual
- A type operator that returns
True
ifSelf == Rhs
, otherwise returnsFalse
. - IsGreater
- A type operator that returns
True
ifSelf > Rhs
, otherwise returnsFalse
. - IsGreater
OrEqual - A type operator that returns
True
ifSelf >= Rhs
, otherwise returnsFalse
. - IsLess
- A type operator that returns
True
ifSelf < Rhs
, otherwise returnsFalse
. - IsLess
OrEqual - A type operator that returns
True
ifSelf <= Rhs
, otherwise returnsFalse
. - IsNot
Equal - A type operator that returns
True
ifSelf != Rhs
, otherwise returnsFalse
. - Len
- A type operator that gives the length of an
Array
or the number of bits in aUInt
. - Logarithm2
- A type operator for taking the integer binary logarithm of
Self
. - Max
- A type operator that returns the maximum of
Self
andRhs
. - Min
- A type operator that returns the minimum of
Self
andRhs
. - Partial
Div - Division as a partial function. This type operator performs division just as
Div
, but is only defined when the result is an integer (i.e. there is no remainder). - Pow
- A type operator that provides exponentiation by repeated squaring.
- Same
- A type operator that ensures that
Rhs
is the same asSelf
, it is mainly useful for writing macros that can take arbitrary binary or unary operators. - Square
Root - A type operator for taking the integer square root of
Self
. - ToInt
- A type operator for taking a concrete integer value from a type.