pub trait Sign {
    // Required methods
    fn is_negative(&self) -> bool;
    fn abs(&self) -> Self;
}
Expand description

A trait about the sign of a number.

We need this because num_traits does not define abs for unsigned numbers.

Required Methods§

source

fn is_negative(&self) -> bool

Return true if the number is negative

source

fn abs(&self) -> Self

Return the absolute value of the number

Implementations on Foreign Types§

source§

impl Sign for u128

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for i8

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for u8

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for usize

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for u32

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for i128

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for NotNan<f64>

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for i16

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for u64

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for i32

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for f64

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for NotNan<f32>

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for f32

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for i64

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for isize

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

source§

impl Sign for u16

source§

fn is_negative(&self) -> bool

source§

fn abs(&self) -> Self

Implementors§