pub enum Digit {
Neg,
Zero,
Pos,
}Expand description
Represents a digit in the balanced ternary numeral system.
A digit can have one of three values:
Neg(-1): Represents the value -1 in the balanced ternary system.Zero(0): Represents the value 0 in the balanced ternary system.Pos(+1): Represents the value +1 in the balanced ternary system.
Provides utility functions for converting to/from characters, integers, and negation.
Variants§
Implementations§
Source§impl Digit
impl Digit
Sourcepub fn to_char(&self) -> char
pub fn to_char(&self) -> char
Converts the Digit into its character representation.
- Returns:
-forDigit::Neg0forDigit::Zero+forDigit::Pos
Sourcepub fn from_char(c: char) -> Digit
pub fn from_char(c: char) -> Digit
Creates a Digit from its character representation.
- Accepts:
-forDigit::Neg0forDigit::Zero+forDigit::Pos
- Panics if the input character is invalid.
Trait Implementations§
impl Copy for Digit
impl Eq for Digit
impl StructuralPartialEq for Digit
Auto Trait Implementations§
impl Freeze for Digit
impl RefUnwindSafe for Digit
impl Send for Digit
impl Sync for Digit
impl Unpin for Digit
impl UnwindSafe for Digit
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