use crate::{
component::Component,
registry::Null,
};
pub trait Length {
const LEN: usize;
}
impl Length for Null {
const LEN: usize = 0;
}
impl<C, R> Length for (C, R)
where
C: Component,
R: Length,
{
const LEN: usize = R::LEN + 1;
}
#[cfg(test)]
mod tests {
use super::Length;
use crate::Registry;
#[test]
fn empty() {
type Registry = Registry!();
assert_eq!(Registry::LEN, 0);
}
#[test]
fn non_empty() {
struct A;
struct B;
struct C;
type Registry = Registry!(A, B, C);
assert_eq!(Registry::LEN, 3);
}
}