1pub mod color;
5
6pub mod profiling;
8
9pub mod path {
13
14 use std::path::{Path, PathBuf};
15
16 pub fn search_for_path(search_locations: &[&Path], stub: &str) -> Option<PathBuf> {
18 for location in search_locations {
19 let p = Path::new(location).join(stub);
20
21 match p.try_exists() {
22 Ok(true) => return Some(p),
23 _ => continue,
24 }
25 }
26
27 None
28 }
29}
30
31#[macro_export]
42macro_rules! cfor {
43 (for ($init:stmt;$cond:expr;$inc:stmt) $body:tt) => {
44 $init
45 while $cond {
46 $body
47 $inc
48 }
49 }
50}
51
52#[cfg(test)]
53mod tests {
54 use super::*;
55
56 #[test]
57 fn cforloop() {
58 cfor!(for (let mut x = 0; x != 5; x += 1) {
59 println!("X is: {}", x + 1);
60 });
61 }
62}