parallel_disk_usage/hardlink/
link_path_list.rs1mod iter;
2mod reflection;
3
4pub use iter::Iter;
5pub use reflection::Reflection;
6
7pub use Reflection as LinkPathListReflection;
8
9use std::path::PathBuf;
10
11#[derive(Debug, Clone)]
18pub struct LinkPathList(Vec<PathBuf>);
19
20impl LinkPathList {
21 #[cfg(any(unix, test))]
23 #[inline]
24 pub(crate) fn single(path: PathBuf) -> Self {
25 LinkPathList(vec![path])
26 }
27
28 #[cfg(test)]
30 pub(crate) fn many(paths: impl IntoIterator<Item: Into<PathBuf>>) -> Self {
31 let paths: Vec<_> = paths.into_iter().map(Into::into).collect();
32 assert!(!paths.is_empty(), "paths must not be empty");
33 LinkPathList(paths)
34 }
35
36 #[cfg(any(unix, test))]
38 #[inline]
39 pub(crate) fn add(&mut self, path: PathBuf) {
40 self.0.push(path)
41 }
42
43 #[inline]
45 pub fn len(&self) -> usize {
46 self.0.len()
47 }
48
49 #[inline]
51 pub fn is_empty(&self) -> bool {
52 self.0.is_empty()
53 }
54
55 #[inline]
57 pub fn into_reflection(self) -> Reflection {
58 self.into()
59 }
60}
61
62#[cfg(test)]
63mod test;