use serde::Deserialize; #[derive(Debug, Clone, Deserialize, Default)] pub struct Config { pub mirror: Option, } #[derive(Debug, Clone, Deserialize, Default)] pub struct MirrorConfig { repos: Vec, mirrorlist: Vec, } impl Config { pub fn is_mirrored_repo(&self, repo: &str) -> bool { if let Some(mirrorc) = &self.mirror { return mirrorc.repos.iter().any(|x| x == repo); } false } pub fn mirrorlist(&self) -> Option<&[String]> { if let Some(mirror) = &self.mirror { return Some(mirror.mirrorlist.as_slice()); } None } }