Trait Signed

Source
pub trait Signed: Sized {
    // Required methods
    fn abs(&self) -> Self;
    fn is_positive(&self) -> bool;
    fn is_negative(&self) -> bool;
    fn is_not_negative(&self) -> bool;
    fn is_not_positive(&self) -> bool;
}

Required Methods§

Source

fn abs(&self) -> Self

Source

fn is_positive(&self) -> bool

Returns true if the number is positive and false if the number is zero or negative.

Source

fn is_negative(&self) -> bool

Returns true if the number is negative and false if the number is zero or positive.

Source

fn is_not_negative(&self) -> bool

For exact arithmetic: Returns true if the number is positive or zero. For approximate arithmetic: returns true if the number is larger than -epsilon

Source

fn is_not_positive(&self) -> bool

For exact arithmetic: Returns true if the number is negative or zero. For approximate arithmetic: returns true if the number is smaller than epsilon

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Signed for f64

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for i8

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for i16

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for i32

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for i64

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for i128

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for u8

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for u16

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for u32

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for u64

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for u128

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for usize

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Source§

impl Signed for BigInt

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Source§

fn is_negative(&self) -> bool

Source§

fn is_not_negative(&self) -> bool

Source§

fn is_not_positive(&self) -> bool

Implementors§