rtlola_streamir/ir/
display.rs

1use itertools::Itertools;
2
3use super::Type;
4
5impl std::fmt::Display for Type {
6    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7        match self {
8            Type::Int(i) => write!(f, "Int({i})"),
9            Type::UInt(u) => write!(f, "UInt({u})"),
10            Type::Bool => write!(f, "Bool"),
11            Type::String => write!(f, "String"),
12            Type::Float32 => write!(f, "Float(32)"),
13            Type::Float64 => write!(f, "Float(64)"),
14            Type::Option(inner) => write!(f, "Option<{inner}>"),
15            Type::Tuple(items) => write!(f, "({})", items.iter().map(|t| t.to_string()).join(",")),
16            Type::Fixed(i) => write!(f, "Fixed{i}"),
17            Type::UFixed(i) => write!(f, "UFixed{i}"),
18            Type::Bytes => write!(f, "Bytes"),
19        }
20    }
21}