1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use std::fmt::{Display, Formatter};
use serde::Serialize;
use crate::value::Value;

#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct Range {
    pub closed: bool,
    pub start: Box<Value>,
    pub end: Box<Value>,
}

impl Display for Range {

    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        Display::fmt(self.start.as_ref(), f)?;
        if self.closed {
            f.write_str("...")?;
        } else {
            f.write_str("..")?;
        }
        Display::fmt(self.end.as_ref(), f)
    }
}