mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
13 lines
292 B
Rust
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())
|
|
};
|
|
}
|