1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
use crate::BooleanNetwork;
use std::fmt::{Display, Error, Formatter};

impl Display for BooleanNetwork {
    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
        write!(f, "{}", self.graph)?;
        for var in self.variables() {
            // print all update functions
            if let Some(fun) = self.get_update_function(var) {
                writeln!(f, "${}: {}", self[var], fun.to_string(self))?;
            }
        }
        Ok(())
    }
}