Moved include into router.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
use super::MTTError;
|
||||
use crate::name::{Name, NameType, Names};
|
||||
use crate::{
|
||||
name::{Name, NameType, Names},
|
||||
router::Include,
|
||||
};
|
||||
use chrono::prelude::*;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
@@ -448,41 +451,6 @@ mod messages {
|
||||
}
|
||||
}
|
||||
|
||||
#[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");
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
pub struct RouteID {
|
||||
action: Option<Action>,
|
||||
|
||||
Reference in New Issue
Block a user