MCPcopy Create free account
hub / github.com/SeaQL/FireDBG.for.Rust / parse_directory

Function parse_directory

parser/src/lib.rs:86–106  ·  view source on GitHub ↗
(directory: T)

Source from the content-addressed store, hash-verified

84}
85
86pub fn parse_directory<T>(directory: T) -> Result<Vec<File>>
87where
88 T: Into<String>,
89{
90 let regex = format!("{}/**/*.rs", directory.into()).replace("//", "/");
91 let mut res = Vec::new();
92 let context = || format!("Invalid glob regex: `{regex}`");
93 for path in glob(&regex).with_context(context)?.filter_map(Result::ok) {
94 let modified = path_created(&path);
95 let file_path = path_to_str(&path).into();
96 let functions = parse_file(&path)
97 .with_context(|| format!("Fail to parse file: `{}`", path.display()))?;
98 res.push(File {
99 path: file_path,
100 functions,
101 crate_name: "".into(),
102 modified,
103 });
104 }
105 Ok(res)
106}
107
108pub fn parse_workspace<T>(directory: T) -> Result<Workspace>
109where

Callers 1

mainFunction · 0.85

Calls 3

parse_fileFunction · 0.85
path_createdFunction · 0.70
path_to_strFunction · 0.70

Tested by

no test coverage detected