coremem_types: add Peano numbers

not used yet, but will be by list/enum operations
This commit is contained in:
2022-07-20 02:47:15 -07:00
parent 2afb3f63d4
commit 5ad6af8f8b
2 changed files with 16 additions and 0 deletions

View File

@@ -1 +1,2 @@
pub mod list;
pub mod peano;

View File

@@ -0,0 +1,15 @@
pub struct PNext<P>(P);
pub struct P0;
pub type P1 = PNext<P0>;
pub trait Peano { }
pub trait PeanoNonZero {
type Prev: Peano;
}
impl Peano for P0 { }
impl<P: Peano> Peano for PNext<P> {}
impl<P: Peano> PeanoNonZero for PNext<P> {
type Prev = P;
}