1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
use std::fmt;

#[derive(PartialEq, PartialOrd, Eq, Ord, Debug)]
pub struct NativeIntegerWidth {
    pub sizes: Vec<i32>,
}

impl fmt::Display for NativeIntegerWidth {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        assert!(!self.sizes.is_empty());

        let sizes_str = self
            .sizes
            .iter()
            .map(|size| size.to_string())
            .collect::<Vec<String>>()
            .join(":");

        write!(f, "n{}", sizes_str)
    }
}