support_bundle_viewer/
index.rs

1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
5use camino::Utf8PathBuf;
6
7/// The index, or list of files, within a support bundle.
8pub struct SupportBundleIndex(Vec<Utf8PathBuf>);
9
10impl SupportBundleIndex {
11    pub fn new(s: &str) -> Self {
12        let mut all_file_names: Vec<_> = s.lines().map(Utf8PathBuf::from).collect();
13        all_file_names.sort();
14        SupportBundleIndex(all_file_names)
15    }
16
17    /// Returns all files in the index, sorted by path
18    pub fn files(&self) -> &Vec<Utf8PathBuf> {
19        &self.0
20    }
21}