use std::{any::Any, fmt::Display}; use super::{MersData, MersType, Type}; #[derive(Debug, Clone)] pub struct Int(pub isize); impl MersData for Int { fn clone(&self) -> Box { Box::new(Clone::clone(self)) } fn as_any(&self) -> &dyn Any { self } fn mut_any(&mut self) -> &mut dyn Any { self } fn to_any(self) -> Box { Box::new(self) } } #[derive(Debug)] pub struct IntT; impl MersType for IntT { fn is_same_type_as(&self, other: &dyn MersType) -> bool { other.as_any().downcast_ref::().is_some() } fn is_included_in_single(&self, target: &dyn MersType) -> bool { self.is_same_type_as(target) } fn as_any(&self) -> &dyn Any { self } fn mut_any(&mut self) -> &mut dyn Any { self } fn to_any(self) -> Box { Box::new(self) } } impl Display for Int { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.0) } }