diff --git a/crates/coremem/src/stim.rs b/crates/coremem/src/stim.rs index 0c402b0..b09ebed 100644 --- a/crates/coremem/src/stim.rs +++ b/crates/coremem/src/stim.rs @@ -45,7 +45,7 @@ impl list::AgnosticVisitor for StimulusListVisitor { impl AbstractStimulus for L where - L: list::MaybeMeta + Sync, + L: list::Meta + Sync, StimulusListVisitor: ListVisitor, { fn at(&self, t_sec: f32, pos: Meters) -> Fields { diff --git a/crates/cross/src/compound/list/flat.rs b/crates/cross/src/compound/list/flat.rs index 695c975..2472b3f 100644 --- a/crates/cross/src/compound/list/flat.rs +++ b/crates/cross/src/compound/list/flat.rs @@ -1,5 +1,5 @@ -use crate::compound::list::{Indexable, MaybeMeta, Meta}; -use crate::compound::peano::{P0, P1, Peano, PNext}; +use crate::compound::list::{Indexable, Meta}; +use crate::compound::peano::{P0, Peano, PNext}; #[cfg(feature = "serde")] use serde::{Serialize, Deserialize}; @@ -291,13 +291,10 @@ impl Appendable for Node } } -impl MaybeMeta for Null { +impl Meta for Null { type Length = P0; } -impl Meta for Node { - type Length = P1; -} impl Meta for Node { type Length = PNext; } diff --git a/crates/cross/src/compound/list/mod.rs b/crates/cross/src/compound/list/mod.rs index e389804..c2b3985 100644 --- a/crates/cross/src/compound/list/mod.rs +++ b/crates/cross/src/compound/list/mod.rs @@ -1,4 +1,4 @@ -use crate::compound::peano::{Peano, PeanoNonZero, P0, PNext}; +use crate::compound::peano::{Peano, P0, PNext}; mod flat; // mod linked; @@ -23,20 +23,11 @@ pub trait Indexable { /// convenience to lookup the type of the element at index `P` of list `L`. pub type ElementAt = >::Element; -/// implemented by any List. +/// implemented by any List (including the Null, empty list) pub trait Meta { - type Length: PeanoNonZero; -} - -/// implemented by any List, or Null (empty list) -pub trait MaybeMeta { type Length: Peano; } -impl MaybeMeta for M { - type Length = M::Length; -} - /// implement on your own type for all `N` of a given list if you want to be able to walk the list. pub trait Visitor { fn visit(&mut self, a: &Arg); @@ -79,17 +70,17 @@ where } /// marker trait for a type which can visit every element in the list `L`. -pub trait ListVisitor: PartialListVisitor::Length> {} +pub trait ListVisitor: PartialListVisitor::Length> {} -impl ListVisitor for V +impl ListVisitor for V where - V: PartialListVisitor::Length> + V: PartialListVisitor::Length> {} /// user-facing API to visit a list pub fn visit(l: &L, v: &mut V) where - L: MaybeMeta, + L: Meta, V: ListVisitor, { v.visit_partial(l)