Moved include into router.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s

This commit is contained in:
2025-12-26 13:48:02 -05:00
parent a63a519ede
commit fd9754d224
4 changed files with 44 additions and 39 deletions

34
src/router.rs Normal file
View File

@@ -0,0 +1,34 @@
#[derive(Clone, Debug, Eq, Hash)]
pub enum Include<T> {
All,
Just(T),
}
impl<T: PartialEq> PartialEq for Include<T> {
fn eq(&self, other: &Self) -> bool {
match self {
Include::All => true,
Include::Just(data) => match other {
Include::All => true,
Include::Just(other_data) => data == other_data,
},
}
}
}
#[cfg(test)]
mod includes {
use super::*;
#[test]
fn does_all_equal_evberything() {
let a: Include<isize> = Include::All;
let b: Include<isize> = Include::Just(5);
let c: Include<isize> = Include::Just(7);
assert!(a == a, "all should equal all");
assert!(a == b, "all should equal some");
assert!(b == a, "some should equal all");
assert!(b == b, "same some should equal");
assert!(b != c, "different somes do not equal");
}
}