#[repr(i8)]pub enum Trit {
N = -1,
Z = 0,
P = 1,
}Expand description
A single balanced ternary property. Analogous to a bit in binary, just with three states: N, Z and P.
Variants§
N = -1
Trit value referring to, negative, -1 or unknown
Z = 0
Trit value referring to, zero, 0, blank or false
P = 1
Trit value referring to, positive, 1 or true
Implementations§
Source§impl Trit
impl Trit
Sourcepub const fn new(val: i8) -> Self
pub const fn new(val: i8) -> Self
Construct a new trit using an i8
For untrusted input, use TryFrom<i8>.
Sourcepub const fn sign(self) -> Self
pub const fn sign(self) -> Self
Return the sign of a trit (returns itself)
It’s implemented here, for compatibility with Word27 and other types
Sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
Return whether a trit is positive (+1)
Sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
Return whether a trit is negative (-1)
Trait Implementations§
Source§impl Ord for Trit
impl Ord for Trit
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Trit
impl PartialOrd for Trit
impl Copy for Trit
impl Eq for Trit
impl StructuralPartialEq for Trit
Auto Trait Implementations§
impl Freeze for Trit
impl RefUnwindSafe for Trit
impl Send for Trit
impl Sync for Trit
impl Unpin for Trit
impl UnsafeUnpin for Trit
impl UnwindSafe for Trit
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