1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
use crate::View;
/// Subtract View a from b
pub struct Subtract<A, B> {
a: A,
b: B,
}
impl<A, B> View for Subtract<A, B>
where
A: View,
B: View,
{
#[inline]
fn update(&mut self, val: f64) {
self.a.update(val);
self.b.update(val);
}
#[inline]
fn last(&self) -> f64 {
self.a.last() - self.b.last()
}
}