symrs/expr/
integral.rs

1use super::*;
2#[derive(Clone)]
3pub struct Integral {
4    f: Box<dyn Expr>,
5}
6
7impl Integral {
8    pub fn new(f: &Box<dyn Expr>) -> Box<dyn Expr> {
9        Box::new(Integral { f: f.clone() })
10    }
11}
12
13impl Expr for Integral {
14    fn get_ref<'a>(&'a self) -> &'a dyn Expr {
15        self as &dyn Expr
16    }
17    fn for_each_arg(&self, f: &mut dyn FnMut(&dyn Arg) -> ()) {
18        f(&*self.f);
19    }
20
21    fn clone_box(&self) -> Box<dyn Expr> {
22        Box::new(self.clone())
23    }
24
25    fn str(&self) -> String {
26        format!("∫{}", self.f.str())
27    }
28}