aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-class-map-generator/src/file_list.rs
blob: 8f0f00f50d76647775e9978a658cedb3e3bff577 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! ref: composer/vendor/composer/class-map-generator/src/FileList.php

use indexmap::IndexMap;

/// Contains a list of files which were scanned to generate a classmap
#[derive(Debug)]
pub struct FileList {
    pub files: IndexMap<String, bool>,
}

impl Default for FileList {
    fn default() -> Self {
        Self::new()
    }
}

impl FileList {
    pub fn new() -> Self {
        FileList {
            files: IndexMap::new(),
        }
    }

    pub fn add(&mut self, path: String) {
        self.files.insert(path, true);
    }

    pub fn contains(&self, path: &str) -> bool {
        self.files.contains_key(path)
    }
}