use std::fmt;
#[derive(Debug)]
pub struct Interval {
pub start: u64,
pub end: u64,
}
impl Interval {
pub fn new(start: u64, end: u64) -> Self {
Self { start, end }
}
}
impl fmt::Display for Interval {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.start == self.end {
write!(f, "{}", self.start)
} else {
write!(f, "{}-{}", self.start, self.end)
}
}
}