Signed

Trait Signed 

Source
pub trait Signed: Num + Neg<Output = Self> {
    const NEG_ONE: Self;

    // Required methods
    fn abs(x: Self) -> Self;
    fn signum(x: Self) -> Self;
}
Expand description

A signed primitive number type.

Required Associated Constants§

Source

const NEG_ONE: Self

Required Methods§

Source

fn abs(x: Self) -> Self

Computes the absolute value of the number.

Source

fn signum(x: Self) -> Self

Returns the sign of the number, or 0 if the number is 0.

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 f32

Source§

const NEG_ONE: Self = -1f32

Source§

fn abs(x: Self) -> Self

Source§

fn signum(x: Self) -> Self

Source§

impl Signed for f64

Source§

const NEG_ONE: Self = -1f64

Source§

fn abs(x: Self) -> Self

Source§

fn signum(x: Self) -> Self

Source§

impl Signed for i8

Source§

const NEG_ONE: Self = -1i8

Source§

fn abs(x: Self) -> Self

Source§

fn signum(x: Self) -> Self

Source§

impl Signed for i16

Source§

const NEG_ONE: Self = -1i16

Source§

fn abs(x: Self) -> Self

Source§

fn signum(x: Self) -> Self

Source§

impl Signed for i32

Source§

const NEG_ONE: Self = -1i32

Source§

fn abs(x: Self) -> Self

Source§

fn signum(x: Self) -> Self

Source§

impl Signed for i64

Source§

const NEG_ONE: Self = -1i64

Source§

fn abs(x: Self) -> Self

Source§

fn signum(x: Self) -> Self

Source§

impl Signed for i128

Source§

const NEG_ONE: Self = -1i128

Source§

fn abs(x: Self) -> Self

Source§

fn signum(x: Self) -> Self

Source§

impl Signed for isize

Source§

const NEG_ONE: Self = -1isize

Source§

fn abs(x: Self) -> Self

Source§

fn signum(x: Self) -> Self

Implementors§