1use crate::Path;
2use serde::{Deserialize, Serialize};
3
4#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
5#[serde(tag = "type", content = "paths")]
6pub enum Scope {
7 Include {
9 include: Vec<Path<'static>>,
10 exclude: Vec<Path<'static>>,
11 },
12 Exclude(Vec<Path<'static>>),
14}
15
16impl Scope {
17 pub fn all() -> Self {
19 Self::Exclude(vec![])
20 }
21
22 pub fn include_and_exclude(include: Vec<Path<'static>>, exclude: Vec<Path<'static>>) -> Self {
24 Self::Include { include, exclude }
25 }
26
27 pub fn include(include: Vec<Path<'static>>) -> Self {
29 Self::Include {
30 include,
31 exclude: vec![],
32 }
33 }
34
35 pub fn exclude(exclude: Vec<Path<'static>>) -> Self {
37 Self::Exclude(exclude)
38 }
39}
40
41impl Default for Scope {
42 fn default() -> Self {
43 Self::all()
44 }
45}