protospec-build 0.3.0

One binary format language to rule them all, One binary format language to find them, One binary format language to bring them all and in the darkness bind them.
Documentation
use super::*;

#[derive(PartialEq, Clone, Debug)]
pub struct ArrayType {
    pub element: Arc<Field>,
    pub length: LengthConstraint,
}


#[derive(PartialEq, Clone, Debug)]
pub struct LengthConstraint {
    pub expandable: bool,
    pub value: Option<Expression>,
}

impl fmt::Display for LengthConstraint {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        if self.expandable {
            write!(f, "..")?;
        }
        if let Some(value) = self.value.as_ref() {
            value.fmt(f)?;
        }
        write!(f, "")
    }
}