1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
use std::collections::HashMap; use super::var::VarId; #[derive(Debug, PartialEq, Clone, Copy)] #[cfg_attr(feature = "serde-support", derive(serde::Serialize))] pub enum InvalidValue { WrongType, BadFormat, Empty, WrongValue, } impl std::error::Error for InvalidValue {} impl std::fmt::Display for InvalidValue { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, PartialEq, Clone)] #[cfg_attr(feature = "serde-support", derive(serde::Serialize))] pub struct InvalidVars(pub HashMap<VarId, InvalidValue>); impl InvalidVars { pub fn new(invalid: HashMap<VarId, InvalidValue>) -> Self { Self(invalid) } }