Trait typerat::NonNegative

source ·
pub trait NonNegative: Sealed { }
Expand description

Marker trait for non-negative numbers.

§Examples

use typerat::*;

fn is_nonnegative<T: NonNegative>() -> bool {
    true
}

assert!(is_nonnegative::<Z0>());
assert!(is_nonnegative::<P1>());
assert!(is_nonnegative::<Q<Z0>>());
assert!(is_nonnegative::<Q<P1>>());
assert!(is_nonnegative::<Q<P2, P3>>());
assert!(is_nonnegative::<N1>());
assert!(is_nonnegative::<Q<N1>>());
assert!(is_nonnegative::<Q<N2, P3>>());

Implementations on Foreign Types§

source§

impl NonNegative for Z0

source§

impl<U> NonNegative for PInt<U>
where U: NonZeroUnsigned,

Implementors§

source§

impl<N, D> NonNegative for Q<N, D>
where N: Numerator<D> + NonNegative, D: Denominator,