Trait PositiveOrNegative

Source
pub trait PositiveOrNegative:
    Zero
    + PartialOrd<Self>
    + Sized {
    // Provided methods
    fn is_positive_or_zero(&self) -> bool { ... }
    fn is_negative_or_zero(&self) -> bool { ... }
    fn is_strictly_positive(&self) -> bool { ... }
    fn is_strictly_negative(&self) -> bool { ... }
}

Provided Methods§

Source

fn is_positive_or_zero(&self) -> bool

Is >= 0

use hexga_math::prelude::*;
debug_assert_eq!((-1).is_positive_or_zero(), false);
debug_assert_eq!(   0.is_positive_or_zero(), true);
debug_assert_eq!(   1.is_positive_or_zero(), true);
Source

fn is_negative_or_zero(&self) -> bool

Is <= 0

use hexga_math::prelude::*;
debug_assert_eq!((-1).is_negative_or_zero(), true);
debug_assert_eq!(   0.is_negative_or_zero(), true);
debug_assert_eq!(   1.is_negative_or_zero(), false);
Source

fn is_strictly_positive(&self) -> bool

Is > 0

use hexga_math::prelude::*;
debug_assert_eq!((-1).is_strictly_positive(), false);
debug_assert_eq!(   0.is_strictly_positive(), false);
debug_assert_eq!(   1.is_strictly_positive(), true);
Source

fn is_strictly_negative(&self) -> bool

Is < 0

use hexga_math::prelude::*;
debug_assert_eq!((-1).is_strictly_negative(), true);
debug_assert_eq!(  0.is_strictly_negative(), false);
debug_assert_eq!(  1.is_strictly_negative(), false);

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.

Implementors§