Documentation
/*
==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--

SJ

Copyright (C) 2019-2025  Anonymous

There are several releases over multiple years,
they are listed as ranges, such as: "2019-2025".

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--
*/

//! # Implementations

use {
    core::num::{NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8},
    super::Number,
};

#[cfg(any(target_pointer_width = "16", target_pointer_width = "32", target_pointer_width = "64"))]
use core::num::{NonZeroIsize, NonZeroUsize};

mod non_zeros;

macro_rules! impl_partial_eq_for_number_and_primitive_numbers { ($($ty: ty),+$(,)?) => {
    $(
        impl PartialEq<$ty> for Number {

            fn eq(&self, other: &$ty) -> bool {
                <$ty>::try_from(self).map(|n| &n == other).unwrap_or(false)
            }

        }

        impl PartialEq<Number> for $ty {

            fn eq(&self, other: &Number) -> bool {
                <$ty>::try_from(other).map(|n| &n == self).unwrap_or(false)
            }

        }
    )+
}}

impl_partial_eq_for_number_and_primitive_numbers!(
    u8, u16, u32, u64, u128,
    i8, i16, i32, i64, i128,
    NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128,
    NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128,
    f32, f64,
);

#[cfg(any(target_pointer_width = "16", target_pointer_width = "32", target_pointer_width = "64"))]
impl_partial_eq_for_number_and_primitive_numbers!(isize, usize, NonZeroUsize, NonZeroIsize);