use std::fmt;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct FqmPrimaryPhase {
pub prime: u128,
pub order: usize,
pub exponent: u128,
pub phase_mod8: i128,
}
impl FqmPrimaryPhase {
pub fn display(&self) -> String {
self.to_string()
}
}
impl fmt::Display for FqmPrimaryPhase {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"FqmPrimaryPhase(prime={}, order={}, exponent={}, phase_mod8={})",
self.prime, self.order, self.exponent, self.phase_mod8
)
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct FqmGaussPhase {
pub order: usize,
pub phase_mod8: i128,
pub primary: Vec<FqmPrimaryPhase>,
}
impl FqmGaussPhase {
pub fn display(&self) -> String {
self.to_string()
}
}
impl fmt::Display for FqmGaussPhase {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"FqmGaussPhase(order={}, phase_mod8={}, primary=[",
self.order, self.phase_mod8
)?;
for (i, p) in self.primary.iter().enumerate() {
if i > 0 {
write!(f, ", ")?;
}
write!(f, "{p}")?;
}
write!(f, "])")
}
}