Add basic search command

This commit is contained in:
bytedream 2023-05-25 18:53:56 +02:00 committed by ByteDream
parent 0beaa99bfd
commit 0aa648b1a5
10 changed files with 1352 additions and 702 deletions

View file

@ -8,7 +8,7 @@ use regex::Regex;
/// If a struct instance equals the [`Default::default()`] it's considered that no find is applied.
/// If `from_*` is [`None`] they're set to [`u32::MIN`].
/// If `to_*` is [`None`] they're set to [`u32::MAX`].
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct InnerUrlFilter {
from_episode: Option<u32>,
to_episode: Option<u32>,
@ -16,11 +16,19 @@ pub struct InnerUrlFilter {
to_season: Option<u32>,
}
#[derive(Debug, Default)]
#[derive(Debug)]
pub struct UrlFilter {
inner: Vec<InnerUrlFilter>,
}
impl Default for UrlFilter {
fn default() -> Self {
Self {
inner: vec![InnerUrlFilter::default()],
}
}
}
impl UrlFilter {
pub fn is_season_valid(&self, season: u32) -> bool {
self.inner.iter().any(|f| {