use core::marker::PhantomData;
#[doc(hidden)]
pub struct Detect<T>(PhantomData<T>);
macro_rules! impl_detect {
(Debug) => {
#[doc(hidden)]
pub trait DebugFallback { const IS_DEBUG: bool = false; }
impl<T> DebugFallback for Detect<T> {}
impl<T: core::fmt::Debug> Detect<T> { pub const IS_DEBUG: bool = true; }
};
($Trait:ident) => {
::paste::paste! {
#[doc(hidden)]
pub trait [<$Trait Fallback>] { const [<IS_ $Trait:upper>]: bool = false; }
impl<T> [<$Trait Fallback>] for Detect<T> {}
impl<T: $Trait> Detect<T> { pub const [<IS_ $Trait:upper>]: bool = true; }
}
};
}
impl_detect!(Clone);
impl_detect!(Copy);
impl_detect!(Debug);
impl_detect!(Default);
impl_detect!(Send);
impl_detect!(Sync);