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 40 41 42 43 44 45 46 47 48 49
use super::{BasicType, BasicTypeBase, TypeKind}; mod functions; mod ops; pub type BoolType = BasicType<BoolImpl>; pub const fn name() -> &'static str { "bool" } pub struct BoolImpl; impl BoolType { pub fn new() -> Self { Self::default() } } impl Default for BoolType { fn default() -> Self { BasicType::from_base_with_functions( BoolImpl, vec![ (crate::ops::NOT, ops::not), (crate::ops::BIT_AND, ops::bit_and), (crate::ops::BIT_OR, ops::bit_or), (crate::ops::BIT_XOR, ops::bit_xor), (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), ("to_string", functions::to_string), ], ) } } impl BasicTypeBase for BoolImpl { fn name(&self) -> &str { self::name() } fn kind(&self) -> TypeKind { TypeKind::Bool } }