use crate::primitives::bool::{Bool, Present, Absent, BoolAnd};
pub trait ByteEq<const A: u8, const B: u8> {
type Out: Bool;
}
impl<const V: u8> ByteEq<V, V> for () {
type Out = Present;
}
use core::marker::PhantomData;
pub struct B<const V: u8>;
pub struct PCons<Head, Tail>(PhantomData<(Head, Tail)>);
pub struct PNil;
pub trait PathEq<Other> {
type Out: Bool;
}
impl PathEq<PNil> for PNil {
type Out = Present;
}
impl<const V: u8, Tail> PathEq<PCons<B<V>, Tail>> for PNil {
type Out = Absent;
}
impl<const V: u8, Tail> PathEq<PNil> for PCons<B<V>, Tail> {
type Out = Absent;
}
impl<const VA: u8, const VB: u8, TailA, TailB> PathEq<PCons<B<VB>, TailB>> for PCons<B<VA>, TailA>
where
(): ByteEq<VA, VB>,
TailA: PathEq<TailB>,
<() as ByteEq<VA, VB>>::Out: BoolAnd<<TailA as PathEq<TailB>>::Out>,
{
type Out = <<() as ByteEq<VA, VB>>::Out as BoolAnd<<TailA as PathEq<TailB>>::Out>>::Out;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct PathIdentity<Path>(PhantomData<Path>);
use crate::primitives::identity::IdentityEq;
impl<P1, P2> IdentityEq<PathIdentity<P2>> for PathIdentity<P1>
where
P1: PathEq<P2>,
{
type Out = <P1 as PathEq<P2>>::Out;
}