dtrees_rs/parsers/mod.rs
1//! Command line parsing for the examples and the `dtrees` CLI.
2
3use crate::caching::{Caching, CoverMap, Trie};
4use clap::ValueEnum;
5
6pub mod examples;
7
8/// The cache of the subproblems.
9#[derive(Debug, Clone, Copy, ValueEnum)]
10pub enum CacheType {
11 /// A trie keyed by the path of tests ([`Trie`]).
12 Trie,
13 /// A hash map keyed by the depth and the instances ([`CoverMap`]).
14 Cover,
15}
16
17impl CacheType {
18 /// A new, empty cache of this type.
19 pub fn new_cache(self) -> Box<dyn Caching> {
20 match self {
21 CacheType::Trie => Box::<Trie>::default(),
22 CacheType::Cover => Box::<CoverMap>::default(),
23 }
24 }
25}