Struct amplify_num::u1 [−][src]
pub struct u1(_);
Expand description
1-bit unsigned integer in the range 0..1
. It can be used instead of bool
when 1-bit numeric (and not boolean) arithmetic is required
Implementations
Creates a new value from a provided `value.
Panics if the value exceeds Self::MAX
Checked integer addition. Computes self + rhs
, returning None
if
overflow occurred.
Saturating integer addition. Computes self + rhs
, saturating at the
numeric bounds instead of overflowing.
Calculates self + rhs
Returns a tuple of the addition along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
Wrapping (modular) addition. Computes self + rhs
, wrapping around at
the boundary of the type.
Checked integer subtraction. Computes self - rhs
, returning None
if
overflow occurred.
Saturating integer subtraction. Computes self - rhs
, saturating at the
numeric bounds instead of overflowing.
Calculates self - rhs
Returns a tuple of the subtraction along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
Wrapping (modular) subtraction. Computes self - rhs
, wrapping around at
the boundary of the type.
Checked integer multiplication. Computes self * rhs
, returning None
if
overflow occurred.
Saturating integer multiplication. Computes self * rhs
, saturating at the
numeric bounds instead of overflowing.
Calculates self * rhs
Returns a tuple of the multiplication along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
Wrapping (modular) multiplication. Computes self * rhs
, wrapping around at
the boundary of the type.
Trait Implementations
Performs the +=
operation. Read more
Performs the &=
operation. Read more
Performs the |=
operation. Read more
Performs the ^=
operation. Read more
Performs the /=
operation. Read more
Performs the *=
operation. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Performs the %=
operation. Read more
Performs the <<=
operation. Read more
Performs the >>=
operation. Read more
Performs the -=
operation. Read more