use super::{Here, There};
pub trait Index: Default + sealed::Sealed {}
impl Index for Here {}
impl<T> Index for There<T> where T: Index {}
mod sealed {
pub trait Sealed {}
impl Sealed for super::Here {}
impl<T> Sealed for super::There<T> where T: super::Index {}
}
pub trait Inc: Index {
type Output: Dec;
fn inc(self) -> Self::Output;
}
impl<T> Inc for T
where
T: Index,
{
type Output = There<T>;
fn inc(self) -> Self::Output {
There::new()
}
}
pub trait Dec: Index {
type Output: Inc;
fn dec(self) -> Self::Output;
}
impl<T> Dec for There<T>
where
T: Index,
{
type Output = T;
fn dec(self) -> Self::Output {
Default::default()
}
}