Skip to main content

arama_env/config/settings/
cache_lookup_strategy.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
4pub enum CacheLookupStrategy {
5    Everywhere,
6    CurrentDirAndSubDirs,
7    #[default]
8    CurrentDirOnly,
9}
10
11impl CacheLookupStrategy {
12    pub const ALL: [CacheLookupStrategy; 3] = [
13        Self::Everywhere,
14        Self::CurrentDirAndSubDirs,
15        Self::CurrentDirOnly,
16    ];
17}
18
19impl std::fmt::Display for CacheLookupStrategy {
20    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21        let label = match self {
22            Self::Everywhere => "Everywhere",
23            Self::CurrentDirAndSubDirs => "Current dir and subdirs",
24            Self::CurrentDirOnly => "Current dir only",
25        };
26        write!(f, "{}", label)
27    }
28}