1//! A simple implementation of peano numbers.
2//!
3//! This is used to enforce that columns can only be selected from a given from
4//! clause if their table appears exactly one time.
56/// A table never appears in the from clause.
7#[allow(missing_debug_implementations, missing_copy_implementations)]
8pub struct Never;
910/// A table appears in the from clause exactly one time.
11#[allow(missing_debug_implementations, missing_copy_implementations)]
12pub struct Once;
1314/// A table appears in the from clause two or more times.
15#[allow(missing_debug_implementations, missing_copy_implementations)]
16pub struct MoreThanOnce;
1718/// Add two peano numbers together.
19///
20/// This is used to determine the number of times a table appears in a from
21/// clause when the from clause contains a join.
22pub trait Plus<T> {
23/// The result of adding these numbers together
24type Output;
25}
2627impl<T> Plus<T> for Never {
28type Output = T;
29}
3031impl<T> Plus<T> for MoreThanOnce {
32type Output = Self;
33}
3435impl Plus<Never> for Once {
36type Output = Self;
37}
3839impl Plus<Once> for Once {
40type Output = MoreThanOnce;
41}
4243impl Plus<MoreThanOnce> for Once {
44type Output = MoreThanOnce;
45}