yazi/yazi-macro/src/fs.rs
2025-09-21 11:44:52 +08:00

13 lines
292 B
Rust

#[macro_export]
macro_rules! ok_or_not_found {
($result:expr, $not_found:expr) => {
match $result {
Ok(v) => v,
Err(e) if e.kind() == std::io::ErrorKind::NotFound => $not_found,
Err(e) => Err(e)?,
}
};
($result:expr) => {
ok_or_not_found!($result, Default::default())
};
}