pub enum Sign {
Positive,
Negative,
}Expand description
An enum representing the sign of a number
A sign can be converted to or from a boolean value, assuming true is Negative.
Variants§
Implementations§
Source§impl Sign
impl Sign
Sourcepub const fn as_sign_str(self, sign_plus: bool) -> &'static str
pub const fn as_sign_str(self, sign_plus: bool) -> &'static str
Return the sign as a string slice for formatting.
Returns "-" for Negative, "+" for Positive when sign_plus
is true, or "" for Positive when sign_plus is false.
§Examples
assert_eq!(Sign::Negative.as_sign_str(false), "-");
assert_eq!(Sign::Positive.as_sign_str(true), "+");
assert_eq!(Sign::Positive.as_sign_str(false), "");Trait Implementations§
impl Copy for Sign
impl Eq for Sign
Source§impl MulAssign for Sign
impl MulAssign for Sign
Source§fn mul_assign(&mut self, rhs: Sign)
fn mul_assign(&mut self, rhs: Sign)
Performs the
*= operation. Read moreSource§impl MulAssign<Sign> for IBig
impl MulAssign<Sign> for IBig
Source§fn mul_assign(&mut self, rhs: Sign)
fn mul_assign(&mut self, rhs: Sign)
Performs the
*= operation. Read moreSource§impl Ord for Sign
impl Ord for Sign
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 Sign
impl PartialOrd for Sign
impl StructuralPartialEq for Sign
Auto Trait Implementations§
impl Freeze for Sign
impl RefUnwindSafe for Sign
impl Send for Sign
impl Sync for Sign
impl Unpin for Sign
impl UnsafeUnpin for Sign
impl UnwindSafe for Sign
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