use num_integer::Integer;
use num_rational::Ratio;
use num_traits::{One, Zero};
use std::marker::Copy;
use std::ops::{Add, Div, Mul, Neg, Sub};
pub trait IntRing:
Zero
+ One
+ Eq
+ PartialEq
+ Neg<Output = Self>
+ Add<Self, Output = Self>
+ Sub<Self, Output = Self>
+ Mul<Self, Output = Self>
+ Copy
+ Clone
{
}
pub trait IntField: IntRing + Div<Self, Output = Self> {}
impl IntRing for i32 {}
impl IntField for i32 {}
impl IntRing for i64 {}
impl IntField for i64 {}
impl<T: Integer + IntRing> IntRing for Ratio<T> {}
impl<T: Integer + IntField> IntField for Ratio<T> {}
pub trait Ccw {
fn ccw() -> Self;
fn is_ccw(&self) -> bool;
}
pub trait OneImag {
fn one_i() -> Self;
fn is_one_i(&self) -> bool;
}
pub trait InnerIntType {
type IntType;
}
impl InnerIntType for i32 {
type IntType = i32;
}
impl InnerIntType for i64 {
type IntType = i64;
}
impl<T: Integer + IntRing + InnerIntType> InnerIntType for Ratio<T> {
type IntType = T::IntType;
}
pub trait Conj {
fn conj(&self) -> Self;
fn co_conj(&self) -> Self;
}
impl<T: Integer + Clone + std::ops::Neg<Output = T>> Conj for Ratio<T> {
fn conj(&self) -> Self {
self.clone()
}
fn co_conj(&self) -> Self {
self.neg()
}
}