Skip to main content

Sign

Trait Sign 

Source
pub trait Sign {
    // Required method
    fn sign(&self) -> Ordering;
}
Expand description

Returns Greater, Equal, or Less, depending on whether a number is positive, zero, or negative, respectively.

Required Methods§

Source

fn sign(&self) -> Ordering

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Sign for f32

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

  • Positive finite numbers, positive zero, and positive infinity have sign Greater.
  • Negative finite numbers, negative zero, and negative infinity have sign Less.
  • NaN has sign Equal.
§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for f64

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

  • Positive finite numbers, positive zero, and positive infinity have sign Greater.
  • Negative finite numbers, negative zero, and negative infinity have sign Less.
  • NaN has sign Equal.
§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for i8

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for i16

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for i32

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for i64

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for i128

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for isize

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for u8

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for u16

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for u32

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for u64

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for u128

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl Sign for usize

Source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§