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 30 31 32 33 34 35 36 37 38 39
use super::{BasicType, BasicTypeBase, TypeKind}; mod functions; mod ops; pub type UnitStructType = BasicType<UnitStructImpl>; pub struct UnitStructImpl { name: Box<str>, } impl UnitStructType { pub fn new(name: impl Into<Box<str>>) -> Self { let name = name.into(); BasicType::from_base_with_functions( UnitStructImpl { name }, vec![ (crate::ops::EQUAL, ops::equal), (crate::ops::NOT_EQUAL, ops::not_equal), (crate::ops::LESS, ops::less), (crate::ops::LESS_OR_EQUAL, ops::less_or_equal), (crate::ops::GREATER, ops::greater), (crate::ops::GREATER_OR_EQUAL, ops::greater_or_equal), ("clone", functions::clone), ], ) } } impl BasicTypeBase for UnitStructImpl { fn name(&self) -> &str { &self.name } fn kind(&self) -> TypeKind { TypeKind::UnitStruct } }