Skip to main content

Signed

Trait Signed 

Source
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§

Source

fn signum(&self) -> Sign

Returns the sign of the number.

Provided Methods§

Source

fn is_positive(&self) -> bool

Whether the number is (strictly) greater than zero.

Source

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§

Source§

impl Signed for NonZero<i8>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for NonZero<i16>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for NonZero<i32>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for NonZero<i64>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for NonZero<i128>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for NonZero<isize>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for NonZero<u8>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for NonZero<u16>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for NonZero<u32>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for NonZero<u64>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for NonZero<u128>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for NonZero<usize>

Source§

fn signum(&self) -> Sign

Source§

impl Signed for i8

Source§

fn signum(&self) -> Sign

Source§

impl Signed for i16

Source§

fn signum(&self) -> Sign

Source§

impl Signed for i32

Source§

fn signum(&self) -> Sign

Source§

impl Signed for i64

Source§

fn signum(&self) -> Sign

Source§

impl Signed for i128

Source§

fn signum(&self) -> Sign

Source§

impl Signed for isize

Source§

fn signum(&self) -> Sign

Source§

impl Signed for u8

Source§

fn signum(&self) -> Sign

Source§

impl Signed for u16

Source§

fn signum(&self) -> Sign

Source§

impl Signed for u32

Source§

fn signum(&self) -> Sign

Source§

impl Signed for u64

Source§

fn signum(&self) -> Sign

Source§

impl Signed for u128

Source§

fn signum(&self) -> Sign

Source§

impl Signed for usize

Source§

fn signum(&self) -> Sign

Implementors§

Source§

impl Signed for Binary

This type is zero or positive; it is never negative.

Source§

impl Signed for NonZeroSign

Source§

impl Signed for One

The only value of this type is 1, which is positive.

Source§

impl Signed for Sign

Source§

impl Signed for SignedOne

This type is positive or negative; it is never zero.

Source§

impl Signed for Zero

The only value of this type is 0, which is neither positive nor negative.

Source§

impl<const S: usize> Signed for NonZeroUbig<S>

Source§

impl<const S: usize> Signed for Ubig<S>