#[doc = crate::_tags!(num namespace)]
#[doc = crate::_doc_meta!{location("num/dom/int")}]
#[doc = crate::doclink!(custom devela "[`NumInt`]" "num/trait.NumInt.html")]
#[must_use]
#[repr(transparent)]
pub struct Int<T>(pub T);
crate::_num_dom_impl_arith![Int: i8, i16, i32, i64, i128, isize];
crate::_num_dom_impl_arith![Int: (no_neg) u8, u16, u32, u64, u128, usize];
#[rustfmt::skip]
mod core_impls {
use crate::{impl_trait, Int, Ordering, ValueQuant};
impl<T: Clone> Clone for Int<T> {
fn clone(&self) -> Self { Self(self.0.clone()) }
}
impl<T: Copy> Copy for Int<T> {}
impl_trait![fmt::Debug for Int[T][T] where T |self, f|
f.debug_tuple("Int").field(&self.0).finish()
];
impl_trait![fmt::Display for Int[T][T] where T |self, f| self.0.fmt(f)];
impl_trait![fmt::Binary for Int[T][T] where T |self, f| self.0.fmt(f)];
impl_trait![fmt::Octal for Int[T][T] where T |self, f| self.0.fmt(f)];
impl_trait![fmt::LowerHex for Int[T][T] where T |self, f| self.0.fmt(f)];
impl_trait![fmt::UpperHex for Int[T][T] where T |self, f| self.0.fmt(f)];
impl_trait![fmt::LowerExp for Int[T][T] where T |self, f| self.0.fmt(f)];
impl_trait![fmt::UpperExp for Int[T][T] where T |self, f| self.0.fmt(f)];
impl<T: PartialEq> PartialEq for Int<T> {
fn eq(&self, other: &Self) -> bool { self.0.eq(&other.0) }
}
impl<T: Eq> Eq for Int<T> {}
impl<T: PartialEq> PartialEq<T> for Int<T> {
fn eq(&self, other: &T) -> bool { self.0.eq(other) }
}
impl<T: PartialOrd> PartialOrd for Int<T> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.0.partial_cmp(&other.0)
}
}
impl<T: Ord> Ord for Int<T> {
fn cmp(&self, other: &Self) -> Ordering {
self.0.cmp(&other.0)
}
}
impl<T: PartialOrd> PartialOrd<T> for Int<T> {
fn partial_cmp(&self, other: &T) -> Option<Ordering> {
self.0.partial_cmp(other)
}
}
impl_trait![Hash for Int[T][T] where T |self, s| self.0.hash(s)];
impl<T: PartialEq> PartialEq<ValueQuant<T, T>> for ValueQuant<Int<T>, Int<T>> {
fn eq(&self, other: &ValueQuant<T, T>) -> bool {
self.v.eq(&other.v) && self.q.eq(&other.q)
}
}
impl<T: PartialEq> PartialEq<ValueQuant<Int<T>, Int<T>>> for ValueQuant<T, T> {
fn eq(&self, other: &ValueQuant<Int<T>, Int<T>>) -> bool {
self.v.eq(&other.v.0) && self.q.eq(&other.q.0)
}
}
impl<T: PartialEq> PartialEq<(T, T)> for ValueQuant<Int<T>, Int<T>> {
fn eq(&self, other: &(T, T)) -> bool {
self.v.eq(&other.0) && self.q.eq(&other.1)
}
}
impl<T: PartialEq> PartialEq<(Int<T>, Int<T>)> for ValueQuant<T, T> {
fn eq(&self, other: &(Int<T>, Int<T>)) -> bool {
self.v.eq(&other.0.0) && self.q.eq(&other.1.0)
}
}
}