librsvg_rebind/unit.rs
1use crate::Unit;
2
3impl std::fmt::Display for Unit {
4 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5 let s = match self {
6 Self::Percent => "%",
7 Self::Px => "px",
8 Self::Em => "em",
9 Self::Ex => "ex",
10 Self::In => "in",
11 Self::Cm => "cm",
12 Self::Mm => "mm",
13 Self::Pt => "pt",
14 Self::Pc => "pc",
15 #[cfg(feature = "v2_59")]
16 Self::Ch => "ch",
17 Self::__Unknown(_) => "unknown",
18 };
19
20 f.write_str(s)
21 }
22}