poulpy_hal/api/module.rs
1use crate::layouts::Backend;
2
3/// Instantiate a new [crate::layouts::Module].
4pub trait ModuleNew<B: Backend> {
5 fn new(n: u64) -> Self;
6}
7
8pub trait ModuleN {
9 fn n(&self) -> usize;
10}
11
12pub trait ModuleLogN
13where
14 Self: ModuleN,
15{
16 fn log_n(&self) -> usize {
17 (u64::BITS - (self.n() as u64 - 1).leading_zeros()) as usize
18 }
19}