pub mod color;
pub mod profiling;
pub mod path {
use std::path::{Path, PathBuf};
pub fn search_for_path(search_locations: &[&Path], stub: &str) -> Option<PathBuf> {
for location in search_locations {
let p = Path::new(location).join(stub);
match p.try_exists() {
Ok(true) => return Some(p),
_ => continue,
}
}
None
}
}
#[macro_export]
macro_rules! cfor {
(for ($init:stmt;$cond:expr;$inc:stmt) $body:tt) => {
$init
while $cond {
$body
$inc
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn cforloop() {
cfor!(for (let mut x = 0; x != 5; x += 1) {
println!("X is: {}", x + 1);
});
}
}