Struct Word
Source pub struct Word<const N: usize>();
Expand description
A fixed-width balanced ternary integer containing N trits.
Trits are stored in little-endian order: index zero is the
least-significant trit.
Number of trits in this word.
Creates a word from little-endian trits.
The first array element is the least-significant trit.
Creates a word with all trits equal to zero.
Returns the stored trits in little-endian order.
Returns the trit at index, or None if it is out of bounds.
Trit zero is the least-significant trit.
Returns the trit at index.
§Panics
Panics if index >= Self::TRIT_COUNT.
Returns the arithmetic negation of this word.
Returns Trit::N, Trit::Z, or Trit::P according to numeric sign.
Returns the non-negative magnitude of this word.
Truncates this word to its least-significant W trits.
§Panics
Panics if W > N. This is a raw fixed-width truncation operation;
it does not check whether the value can be represented losslessly.
The minimum representable value for a tribble.
The maximum representable value for a tribble.
Converts this tribble to its native integer representation.
The minimum representable value for a tryte.
The maximum representable value for a tryte.
Converts this tryte to its native integer representation.
The minimum representable value for a 27-trit word.
The maximum representable value for a 27-trit word.
Converts this 27-trit word to its native integer representation.
The minimum representable value for a 54-trit word.
The maximum representable value for a 54-trit word.
Converts this 54-trit word to its native integer representation.
Returns the component-wise ternary minimum.
Returns the component-wise ternary maximum.
Returns the tritwise ternary negation.
Each N becomes P, each P becomes N, and Z remains Z.
Returns the tritwise clipping of this word.
Returns a word-valued numeric sign: -1, 0, or +1.
Returns the tritwise consensus of two words.
Shifts trits left by count, filling low trits with zero.
If count >= Self::TRIT_COUNT, returns zero.
Returns the arithmetic right shift by count trits.
Vacated most-significant trits are filled with the numeric sign.
If count >= Self::TRIT_COUNT, every trit becomes the sign trit.
Returns the logical right shift by count trits.
Vacated most-significant trits are filled with zero.
If count >= Self::TRIT_COUNT, returns zero.
The resulting type after applying the + operator.
The resulting type after applying the + operator.
The resulting type after applying the + operator.
The resulting type after applying the + operator.
The resulting type after applying the + operator.
The resulting type after applying the + operator.
The resulting type after applying the + operator.
The type produced by a successful division.
Divides self by rhs, returning None when rhs is zero.
The type produced by a successful division.
Divides self by rhs, returning None when rhs is zero.
The type produced by a successful division.
Divides self by rhs, returning None when rhs is zero.
The type produced by a successful division.
Divides self by rhs, returning None when rhs is zero.
The type produced by a successful division.
Divides self by rhs, returning None when rhs is zero.
The type produced by a successful division.
Divides self by rhs, returning None when rhs is zero.
Performs copy-assignment from
source.
Read more
Formats the value using the given formatter.
Read more
Formats the value using the given formatter.
Read more
The resulting type after applying the / operator.
The resulting type after applying the / operator.
The resulting type after applying the / operator.
The resulting type after applying the / operator.
The resulting type after applying the / operator.
The resulting type after applying the / operator.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
The resulting type after applying the * operator.
The resulting type after applying the * operator.
The resulting type after applying the * operator.
The resulting type after applying the * operator.
The resulting type after applying the * operator.
The resulting type after applying the * operator.
The resulting type after applying the * operator.
The resulting type after applying the - operator.
Compares and returns the maximum of two values.
Read more
Compares and returns the minimum of two values.
Read more
Restrict a value to a certain interval.
Read more
Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
This method returns an ordering between
self and
other values if one exists.
Read more
Tests less than (for
self and
other) and is used by the
< operator.
Read more
Tests less than or equal to (for
self and
other) and is used by the
<= operator.
Read more
Tests greater than (for
self and
other) and is used by the
>
operator.
Read more
Tests greater than or equal to (for
self and
other) and is used by
the
>= operator.
Read more
The resulting type after applying the - operator.
The resulting type after applying the - operator.
The resulting type after applying the - operator.
The resulting type after applying the - operator.
The resulting type after applying the - operator.
The resulting type after applying the - operator.
The resulting type after applying the - operator.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more
Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
Converts the given value to a
String.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.