pub struct Tryte { /* private fields */ }Expand description
A struct representing a balanced ternary number with a fixed length of 6 digits.
The underlying representation of the number is an array of six Digit values.
This struct provides conversion methods to and from other formats.
Implementations§
Source§impl Tryte
impl Tryte
Sourcepub fn to_ternary(&self) -> Ternary
pub fn to_ternary(&self) -> Ternary
Converts the Tryte into its Ternary representation.
§Returns
A Ternary object representing the same balanced ternary number.
Sourcepub fn to_digit_slice(&self) -> &[Digit]
pub fn to_digit_slice(&self) -> &[Digit]
Retrieves a slice containing the digits of the Tryte.
§Returns
A slice referencing the six-digit array of the Tryte.
This function allows access to the raw representation of the
balanced ternary number as a slice of Digit values.
Sourcepub fn from_ternary(v: &Ternary) -> Self
pub fn from_ternary(v: &Ternary) -> Self
Sourcepub fn to_i16(&self) -> i16
pub fn to_i16(&self) -> i16
Converts the Tryte into a signed 16-bit integer.
§Returns
A i16 representing the decimal value of the Tryte.
Trait Implementations§
impl Copy for Tryte
impl Eq for Tryte
impl StructuralPartialEq for Tryte
Auto Trait Implementations§
impl Freeze for Tryte
impl RefUnwindSafe for Tryte
impl Send for Tryte
impl Sync for Tryte
impl Unpin for Tryte
impl UnwindSafe for Tryte
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more