nintypes 0.2.11

Nintondo shared types
Documentation
#[derive(
    bytemuck::Pod,
    bytemuck::Zeroable,
    Copy,
    Clone,
    serde::Serialize,
    serde::Deserialize,
    derive_more::Display,
    derive_more::FromStr,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Default,
    derive_more::Add,
    derive_more::Sub,
    derive_more::Mul,
    derive_more::From,
)]
#[mul(forward)]
#[repr(C)]
#[serde(transparent)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct UpdateId(pub u32);

impl num_traits::Bounded for UpdateId {
    fn min_value() -> Self {
        Self(0)
    }

    fn max_value() -> Self {
        Self(u32::MAX)
    }
}

impl num_traits::Zero for UpdateId {
    fn zero() -> Self {
        Self(0)
    }

    fn is_zero(&self) -> bool {
        self.0 == 0
    }
}

impl num_traits::One for UpdateId {
    fn one() -> Self {
        Self(1)
    }
}

impl std::fmt::Debug for UpdateId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        self.0.fmt(f)
    }
}

impl num_traits::SaturatingAdd for UpdateId {
    fn saturating_add(&self, v: &Self) -> Self {
        Self(self.0.saturating_add(v.0))
    }
}