tea_dtype/bool_type.rs
1/// A trait for types that can be converted to a boolean value.
2///
3/// This trait is implemented for `bool` and `&bool`, allowing for a consistent
4/// interface to obtain a boolean value from these types.
5pub trait BoolType: Copy {
6 /// Converts the implementing type to a boolean value.
7 ///
8 /// # Returns
9 ///
10 /// A `bool` representing the boolean value of the implementing type.
11 fn bool_(self) -> bool;
12}
13
14impl BoolType for bool {
15 #[inline(always)]
16 fn bool_(self) -> bool {
17 self
18 }
19}
20
21impl BoolType for &bool {
22 #[inline(always)]
23 fn bool_(self) -> bool {
24 *self
25 }
26}