powers_pf/
pfmpc.rs

1use powers::MPC;
2use std::ops::{Deref, DerefMut};
3
4#[derive(Clone, Default)]
5pub struct PFMPC {
6    mpc: MPC,
7    pub(crate) success: Option<bool>,
8    pub(crate) iterations: Option<usize>,
9}
10
11impl PFMPC {
12    pub(crate) fn new(mpc: MPC) -> Self {
13        Self {
14            mpc,
15            success: None,
16            iterations: None,
17        }
18    }
19
20    pub fn success(&self) -> bool {
21        self.success.unwrap_or_default()
22    }
23
24    pub fn iterations(&self) -> usize {
25        self.iterations.unwrap_or_default()
26    }
27}
28
29impl Deref for PFMPC {
30    type Target = MPC;
31
32    fn deref(&self) -> &Self::Target {
33        &self.mpc
34    }
35}
36
37impl DerefMut for PFMPC {
38    fn deref_mut(&mut self) -> &mut Self::Target {
39        &mut self.mpc
40    }
41}