pub trait Signed {
// Required method
fn signum(&self) -> Sign;
// Provided methods
fn is_positive(&self) -> bool { ... }
fn is_negative(&self) -> bool { ... }
}Expand description
§Signed numbers
A number that is positive, negative or zero.
Required Methods§
Provided Methods§
Sourcefn is_positive(&self) -> bool
fn is_positive(&self) -> bool
Whether the number is (strictly) greater than zero.
Sourcefn is_negative(&self) -> bool
fn is_negative(&self) -> bool
Whether the number is (strictly) smaller than zero.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Implementors§
impl Signed for Binary
This type is zero or positive; it is never negative.
impl Signed for NonZeroSign
impl Signed for One
The only value of this type is 1, which is positive.
impl Signed for Sign
impl Signed for SignedOne
This type is positive or negative; it is never zero.
impl Signed for Zero
The only value of this type is 0, which is neither positive nor negative.