tulpje_cache/
config.rs

1use twilight_cache_inmemory::ResourceType;
2
3pub struct Config {
4    pub resource_types: ResourceType,
5    pub message_cache_size: usize,
6}
7
8impl Config {
9    pub fn new() -> Self {
10        Self {
11            resource_types: ResourceType::empty(),
12            message_cache_size: 100,
13        }
14    }
15
16    pub fn resource_types(mut self, resource_types: ResourceType) -> Self {
17        self.resource_types = resource_types;
18        self
19    }
20
21    pub fn message_cache_size(mut self, message_cache_size: usize) -> Self {
22        self.message_cache_size = message_cache_size;
23        self
24    }
25
26    pub(crate) fn wants(&self, resource_type: ResourceType) -> bool {
27        self.resource_types.contains(resource_type)
28    }
29}
30
31impl Default for Config {
32    fn default() -> Self {
33        Self::new()
34    }
35}