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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use crate::internal::commas;
use crate::Assign;
use std::fmt;
#[derive(Debug, Clone)]
pub struct Phi {
dependencies: Vec<Assign>,
}
impl Phi {
pub(crate) fn new() -> Self {
Self {
dependencies: Vec::new(),
}
}
pub(crate) fn extend<I>(&mut self, iter: I)
where
I: IntoIterator<Item = Assign>,
{
self.dependencies.extend(iter);
}
}
impl fmt::Display for Phi {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.dependencies.is_empty() {
write!(f, "φ(?)")?;
} else {
write!(f, "φ({})", commas(&self.dependencies))?;
}
Ok(())
}
}