#[cfg(feature = "alloc")]
use alloc::string::String;
pub trait RawState: Send + Sync + core::fmt::Debug {
private!();
}
pub trait DisplayState: RawState
where
Self: core::fmt::Display,
{
private!();
}
pub trait HashState: RawState
where
Self: Eq + core::hash::Hash,
{
private!();
}
pub trait StdState: DisplayState
where
Self: Clone + Default + PartialEq + PartialOrd,
{
private!();
}
pub trait NumState: StdState
where
Self: Copy
+ Default
+ Eq
+ PartialOrd
+ core::ops::Add<Output = Self>
+ core::ops::Sub<Output = Self>
+ core::ops::Mul<Output = Self>
+ core::ops::Div<Output = Self>
+ core::ops::Rem<Output = Self>
+ core::ops::Neg<Output = Self>
+ core::ops::Not<Output = Self>
+ core::ops::AddAssign
+ core::ops::SubAssign
+ core::ops::MulAssign
+ core::ops::DivAssign
+ num_traits::One
+ num_traits::Zero
+ num_traits::ToPrimitive
+ num_traits::FromPrimitive,
{
private!();
}
impl<T> RawState for &T
where
T: RawState,
{
seal!();
}
impl<T> RawState for &mut T
where
T: RawState,
{
seal!();
}
impl<T> DisplayState for T
where
T: RawState + core::fmt::Display,
{
seal!();
}
impl<T> HashState for T
where
T: RawState + Eq + core::hash::Hash,
{
seal!();
}
impl<T> StdState for T
where
T: RawState + Clone + Default + PartialEq + PartialOrd + core::fmt::Display,
{
seal!();
}
impl<T> NumState for T
where
T: StdState
+ Copy
+ Eq
+ PartialOrd
+ core::ops::Add<Output = Self>
+ core::ops::Sub<Output = Self>
+ core::ops::Mul<Output = Self>
+ core::ops::Div<Output = Self>
+ core::ops::Rem<Output = Self>
+ core::ops::Neg<Output = Self>
+ core::ops::Not<Output = Self>
+ core::ops::AddAssign
+ core::ops::SubAssign
+ core::ops::MulAssign
+ core::ops::DivAssign
+ num_traits::One
+ num_traits::Zero
+ num_traits::ToPrimitive
+ num_traits::FromPrimitive,
{
seal!();
}
impl<Q> RawState for core::ops::ControlFlow<Q, Q>
where
Q: RawState,
{
seal!();
}
impl<Q> RawState for core::mem::MaybeUninit<Q>
where
Q: RawState,
{
seal!();
}
#[cfg(feature = "alloc")]
impl RawState for Box<dyn RawState> {
seal!();
}
macro_rules! impl_raw_state {
($($t:ty),* $(,)?) => {
$(
impl_raw_state!(@impl $t);
)*
};
(@impl $t:ty) => {
impl $crate::state::RawState for $t {
seal!();
}
};
}
impl_raw_state! {
usize, u8, u16, u32, u64, u128,
isize, i8, i16, i32, i64, i128,
f32, f64, bool, char,
}
#[cfg(feature = "alloc")]
impl_raw_state! {
String,
}