plonky2/field/src/ops.rs
Jakub Nabaglo ea43053532
Square trait (#409)
* `Squarable` trait

* Minor style

* Further minor style (Squarable -> Square to match Rust convention)
2021-12-30 12:11:02 -08:00

12 lines
194 B
Rust

use std::ops::Mul;
pub trait Square {
fn square(&self) -> Self;
}
impl<F: Mul<F, Output = Self> + Copy> Square for F {
default fn square(&self) -> Self {
*self * *self
}
}