Skip to main content

Signed

Trait Signed 

Source
pub trait Signed:
    Num
    + Neg<Output = Self>
    + PartialOrd {
    // Required methods
    fn abs(self) -> Self;
    fn signum(self) -> Self;
    fn is_negative(self) -> bool;
}
Expand description

Signed numbers: negation, absolute value, sign.

Required Methods§

Source

fn abs(self) -> Self

Absolute value.

Source

fn signum(self) -> Self

-1, 0, or +1.

Source

fn is_negative(self) -> bool

Returns true if the number is negative.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Signed for f32

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn is_negative(self) -> bool

Source§

impl Signed for f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn is_negative(self) -> bool

Source§

impl Signed for i8

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn is_negative(self) -> bool

Source§

impl Signed for i16

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn is_negative(self) -> bool

Source§

impl Signed for i32

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn is_negative(self) -> bool

Source§

impl Signed for i64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn is_negative(self) -> bool

Source§

impl Signed for isize

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn is_negative(self) -> bool

Implementors§