1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
    Appellation: eval <module>
    Contrib: FL03 <jo3mccain@icloud.com>
*/

pub trait EvaluateOnce {
    type Output;

    fn eval_once(self) -> Self::Output;
}

pub trait EvaluateMut: EvaluateOnce {
    fn eval_mut(&mut self) -> Self::Output;
}

pub trait Evaluate: EvaluateMut {
    fn eval(&self) -> Self::Output;
}

impl EvaluateOnce for f64 {
    type Output = f64;

    fn eval_once(self) -> Self::Output {
        self
    }
}