cnfy-uint 0.2.3

Zero-dependency 256-bit unsigned integer arithmetic for cryptographic applications
Documentation
//! [`Default`] implementation for [`U256`], returning zero.
use super::U256;

/// Returns the zero value as the default for [`U256`].
///
/// This is consistent with the standard library convention where numeric
/// types default to zero. Equivalent to [`U256::ZERO`].
///
/// # Examples
///
/// ```
/// use cnfy_uint::u256::U256;
///
/// let d: U256 = Default::default();
/// assert_eq!(d, U256::ZERO);
/// ```
impl Default for U256 {
    #[inline]
    fn default() -> Self {
        Self::ZERO
    }
}

#[cfg(test)]
mod ai_tests {
    use super::*;

    /// Default produces the zero value.
    #[test]
    fn default_is_zero() {
        assert_eq!(U256::default(), U256::ZERO);
    }

    /// Default equals from_be_limbs with all zeros.
    #[test]
    fn default_matches_explicit_zero() {
        assert_eq!(U256::default(), U256::from_be_limbs([0, 0, 0, 0]));
    }
}