use super::*; #[derive(PartialEq, Debug, Clone)] pub(crate) struct Condition<'src> { pub(crate) lhs: Box>, pub(crate) rhs: Box>, pub(crate) operator: ConditionalOperator, } impl<'src> Display for Condition<'src> { fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> { write!(f, "{} {} {}", self.lhs, self.operator, self.rhs) } } impl<'src> Serialize for Condition<'src> { fn serialize(&self, serializer: S) -> Result where S: Serializer, { let mut seq = serializer.serialize_seq(None)?; seq.serialize_element(&self.operator.to_string())?; seq.serialize_element(&self.lhs)?; seq.serialize_element(&self.rhs)?; seq.end() } }