mod private {
pub trait Sealed {}
}
use core::borrow::{Borrow, BorrowMut};
pub(crate) use private::Sealed;
impl<A: Sealed, B: Sealed> Sealed for (A, B) {}
impl<A: Sealed, B: Sealed, C: Sealed> Sealed for (A, B, C) {}
impl<A: Sealed, B: Sealed, C: Sealed, D: Sealed> Sealed for (A, B, C, D) {}
impl Sealed for frunk::HNil {}
impl<H: Sealed, T: Sealed> Sealed for frunk::HCons<H, T> {}
pub trait Is
where
Self: Sealed,
Self: From<IsType<Self>>,
Self: Into<IsType<Self>>,
Self: Borrow<IsType<Self>>,
Self: BorrowMut<IsType<Self>>,
{
#[allow(missing_docs)]
type Type;
}
pub type IsType<T> = <T as Is>::Type;
impl<T> Is for T
where
T: Sealed + Borrow<T> + BorrowMut<T>,
{
type Type = T;
}
pub trait OptionT: Sealed {
const IS_SOME: bool;
}
pub struct OptionTNone;
impl Sealed for OptionTNone {}
impl OptionT for OptionTNone {
const IS_SOME: bool = false;
}
pub struct OptionTSome<T>(pub T);
impl<T> Sealed for OptionTSome<T> {}
impl<T> OptionT for OptionTSome<T> {
const IS_SOME: bool = true;
}