use crate::Path;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(tag = "type", content = "paths")]
pub enum Scope {
Include {
include: Vec<Path<'static>>,
exclude: Vec<Path<'static>>,
},
Exclude(Vec<Path<'static>>),
}
impl Scope {
pub fn all() -> Self {
Self::Exclude(vec![])
}
pub fn include_and_exclude(include: Vec<Path<'static>>, exclude: Vec<Path<'static>>) -> Self {
Self::Include { include, exclude }
}
pub fn include(include: Vec<Path<'static>>) -> Self {
Self::Include {
include,
exclude: vec![],
}
}
pub fn exclude(exclude: Vec<Path<'static>>) -> Self {
Self::Exclude(exclude)
}
}
impl Default for Scope {
fn default() -> Self {
Self::all()
}
}