numaxiom 0.0.2

Lightweight numeric marker traits for ranges/signs plus constants and ops; std by default, no_std optional.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// Marker trait for types that guarantee values strictly greater than zero.
/// Implementers must ensure all inhabited values are `> 0`.
pub trait Positive {}

macro_rules! impl_positive_for_nonzero_unsigned {
    ($($ty:ty),+ $(,)?) => {
        $(impl Positive for $ty {})+
    };
}

impl_positive_for_nonzero_unsigned!(
    core::num::NonZeroU8,
    core::num::NonZeroU16,
    core::num::NonZeroU32,
    core::num::NonZeroU64,
    core::num::NonZeroU128,
    core::num::NonZeroUsize,
);