1mod file_navigation;
2
3use std::collections::HashSet;
4use std::fmt;
5
6pub fn get_all_dependencies_from_dir(dir_path: &str) -> Result<HashSet<String>, DependencyListerError> {
12 file_navigation::get_all_dependencies_from_dir(dir_path)
13}
14
15#[derive(Debug, PartialEq)]
19pub enum DependencyListerError {
20 UnsuportedFileEncoding(Vec<u8>),
22
23 UnableToRead(String),
25
26 NotALink(String),
28
29 UnsuportedFileName(String),
31
32 DirectoryReadingError(String),
34}
35
36use DependencyListerError::*;
37
38impl fmt::Display for DependencyListerError {
39 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
42 match self {
43 UnsuportedFileEncoding(x) => write!(f, "Unsuported file name encoding. Binary file name: {x:?}"),
44 UnableToRead(x) => write!(f, "Unable to read the file {x}"),
45 NotALink(x) => write!(f, "Expected {x} to be a link but it is not."),
46 UnsuportedFileName(x) => write!(f, "Unsuported file name {x}"),
47 DirectoryReadingError(x) => write!(f, "Error while reading directory {x}"),
48 }
49 }
50}
51