Trait Sign

Source
pub trait Sign: Signed {
    // Required methods
    fn signum(self) -> Self;
    fn abs(self) -> Self;
}
Expand description

Helpful methods for manipulating an element’s order relative to 0

Required Methods§

Source

fn signum(self) -> Self

Returns 1 if positive, -1 if negative, or itself (ie. 0 or NaN) if neither

Source

fn abs(self) -> Self

Returns this element’s negative if less than 0 or itself otherwise

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 Sign for f32

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for f64

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for i8

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for i16

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for i32

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for i64

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for i128

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for isize

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for u8

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for u16

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for u32

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for u64

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for u128

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Source§

impl Sign for usize

Source§

fn signum(self) -> Self

Source§

fn abs(self) -> Self

Implementors§