#![doc = include_str!("../Readme.md")]
#![no_std]
use core::borrow::Borrow;
use core::cmp::Ordering;
use core::fmt::{self, Debug, Display, Formatter};
use core::hash::{Hash, Hasher};
use core::mem::transmute;
use core::ops::{Deref, DerefMut, Not};
use i32 as BOOL; use u8 as BOOLEAN;
#[allow(non_camel_case_types)] #[derive(Clone, Copy)]
#[repr(transparent)] pub struct bool8(BOOLEAN);
pub use bool8 as b8;
impl bool8 {
pub const FALSE : bool8 = bool8(0);
pub const TRUE : bool8 = bool8(1);
pub fn from(value: impl Into<Self>) -> Self { value.into() }
}
#[allow(non_camel_case_types)] #[derive(Clone, Copy)]
#[repr(transparent)] pub struct bool32(BOOL);
pub use bool32 as b32;
impl bool32 {
pub const FALSE : bool32 = bool32(0);
pub const TRUE : bool32 = bool32(1);
pub fn from(value: impl Into<Self>) -> Self { value.into() }
}
impl AsRef<bool> for bool8 { fn as_ref(&self) -> &bool { if bool::from(*self) { &true } else { &false } } }
impl AsRef<bool> for bool32 { fn as_ref(&self) -> &bool { if bool::from(*self) { &true } else { &false } } }
impl Borrow<bool> for bool8 { fn borrow(&self) -> &bool { if bool::from(*self) { &true } else { &false } } }
impl Borrow<bool> for bool32 { fn borrow(&self) -> &bool { if bool::from(*self) { &true } else { &false } } }
impl Deref for bool8 { type Target = BOOLEAN; fn deref(&self) -> &Self::Target { &self.0 } }
impl Deref for bool32 { type Target = BOOL; fn deref(&self) -> &Self::Target { &self.0 } }
impl DerefMut for bool8 { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } }
impl DerefMut for bool32 { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } }
impl Default for bool8 { fn default() -> Self { Self::FALSE } }
impl Default for bool32 { fn default() -> Self { Self::FALSE } }
impl Debug for bool8 { fn fmt(&self, f: &mut Formatter) -> fmt::Result { Debug ::fmt(&bool::from(*self), f) } }
impl Debug for bool32 { fn fmt(&self, f: &mut Formatter) -> fmt::Result { Debug ::fmt(&bool::from(*self), f) } }
impl Display for bool8 { fn fmt(&self, f: &mut Formatter) -> fmt::Result { Display::fmt(&bool::from(*self), f) } }
impl Display for bool32 { fn fmt(&self, f: &mut Formatter) -> fmt::Result { Display::fmt(&bool::from(*self), f) } }
impl From<bool > for bool8 { fn from(value: bool ) -> Self { Self(value as _) } }
impl From<bool > for bool32 { fn from(value: bool ) -> Self { Self(value as _) } }
impl From<BOOLEAN> for bool8 { fn from(value: BOOLEAN) -> Self { Self(value) } } impl From<BOOL > for bool32 { fn from(value: BOOL ) -> Self { Self(value) } } impl From<bool8 > for BOOLEAN { fn from(value: bool8 ) -> Self { value.0 } } impl From<bool32 > for BOOL { fn from(value: bool32 ) -> Self { value.0 } } impl From<bool8 > for bool { fn from(value: bool8 ) -> Self { value.0 != 0 } }
impl From<bool32 > for bool { fn from(value: bool32 ) -> Self { value.0 != 0 } }
impl From<&BOOLEAN> for &bool8 { fn from(value: &BOOLEAN) -> Self { unsafe { transmute(value) } } } impl From<&BOOL > for &bool32 { fn from(value: &BOOL ) -> Self { unsafe { transmute(value) } } } impl From<&bool8 > for &BOOLEAN { fn from(value: &bool8 ) -> Self { unsafe { transmute(value) } } } impl From<&bool32 > for &BOOL { fn from(value: &bool32 ) -> Self { unsafe { transmute(value) } } }
impl Not for bool8 { type Output = bool; fn not(self) -> Self::Output { self.0 == 0 } }
impl Not for bool32 { type Output = bool; fn not(self) -> Self::Output { self.0 == 0 } }
impl Eq for bool8 {}
impl Eq for bool32 {}
impl PartialEq<bool8 > for bool8 { fn eq(&self, other: &bool8 ) -> bool { bool::from(*self) == bool::from(*other) } }
impl PartialEq<bool32> for bool32 { fn eq(&self, other: &bool32) -> bool { bool::from(*self) == bool::from(*other) } }
impl PartialEq<bool8 > for bool32 { fn eq(&self, other: &bool8 ) -> bool { bool::from(*self) == bool::from(*other) } }
impl PartialEq<bool32> for bool8 { fn eq(&self, other: &bool32) -> bool { bool::from(*self) == bool::from(*other) } }
impl PartialEq<bool > for bool8 { fn eq(&self, other: &bool ) -> bool { bool::from(*self) == *other } }
impl PartialEq<bool > for bool32 { fn eq(&self, other: &bool ) -> bool { bool::from(*self) == *other } }
impl PartialEq<bool8 > for bool { fn eq(&self, other: &bool8 ) -> bool { bool::from(*other) == *self } }
impl PartialEq<bool32> for bool { fn eq(&self, other: &bool32) -> bool { bool::from(*other) == *self } }
impl PartialOrd<bool8 > for bool8 { fn partial_cmp(&self, other: &bool8 ) -> Option<Ordering> { PartialOrd::partial_cmp(&bool::from(*self), &bool::from(*other)) } }
impl PartialOrd<bool32> for bool32 { fn partial_cmp(&self, other: &bool32) -> Option<Ordering> { PartialOrd::partial_cmp(&bool::from(*self), &bool::from(*other)) } }
impl PartialOrd<bool8 > for bool32 { fn partial_cmp(&self, other: &bool8 ) -> Option<Ordering> { PartialOrd::partial_cmp(&bool::from(*self), &bool::from(*other)) } }
impl PartialOrd<bool32> for bool8 { fn partial_cmp(&self, other: &bool32) -> Option<Ordering> { PartialOrd::partial_cmp(&bool::from(*self), &bool::from(*other)) } }
impl PartialOrd<bool > for bool8 { fn partial_cmp(&self, other: &bool ) -> Option<Ordering> { PartialOrd::partial_cmp(&bool::from(*self), other) } }
impl PartialOrd<bool > for bool32 { fn partial_cmp(&self, other: &bool ) -> Option<Ordering> { PartialOrd::partial_cmp(&bool::from(*self), other) } }
impl PartialOrd<bool8 > for bool { fn partial_cmp(&self, other: &bool8 ) -> Option<Ordering> { PartialOrd::partial_cmp(self, &bool::from(*other)) } }
impl PartialOrd<bool32> for bool { fn partial_cmp(&self, other: &bool32) -> Option<Ordering> { PartialOrd::partial_cmp(self, &bool::from(*other)) } }
impl Ord for bool8 { fn cmp(&self, other: &bool8 ) -> Ordering { Ord::cmp(&bool::from(*self), &bool::from(*other)) } }
impl Ord for bool32 { fn cmp(&self, other: &bool32) -> Ordering { Ord::cmp(&bool::from(*self), &bool::from(*other)) } }
impl Hash for bool8 { fn hash<H: Hasher>(&self, state: &mut H) { bool::from(*self).hash(state) } }
impl Hash for bool32 { fn hash<H: Hasher>(&self, state: &mut H) { bool::from(*self).hash(state) } }
#[cfg(feature = "bytemuck")] mod _bytemuck {
use super::*;
unsafe impl bytemuck::Pod for bool8 {}
unsafe impl bytemuck::Pod for bool32 {}
unsafe impl bytemuck::Zeroable for bool8 {}
unsafe impl bytemuck::Zeroable for bool32 {}
}