MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / collect_protos

Function collect_protos

libatomic/build.rs:4–17  ·  view source on GitHub ↗
(dir: &PathBuf, out: &mut Vec<PathBuf>)

Source from the content-addressed store, hash-verified

2use std::path::PathBuf;
3
4fn collect_protos(dir: &PathBuf, out: &mut Vec<PathBuf>) {
5 let mut entries: Vec<_> = std::fs::read_dir(dir)
6 .expect("proto dir readable")
7 .map(|e| e.expect("proto entry").path())
8 .collect();
9 entries.sort();
10 for path in entries {
11 if path.is_dir() {
12 collect_protos(&path, out);
13 } else if path.extension().and_then(|e| e.to_str()) == Some("proto") {
14 out.push(path);
15 }
16 }
17}
18
19fn main() -> Result<(), Box<dyn std::error::Error>> {
20 #[cfg(feature = "node")]

Callers 1

mainFunction · 0.85

Calls 6

sortMethod · 0.80
is_dirMethod · 0.80
extensionMethod · 0.80
collectMethod · 0.45
pathMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected