diff --git a/Cargo.toml b/Cargo.toml index 907c6a5..e1c196c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bp3d-util" -version = "2.1.0" +version = "2.1.1" authors = ["Yuri Edward "] edition = "2021" description = "OS independant Rust language utilities." diff --git a/src/result.rs b/src/result.rs index 84d2936..5050579 100644 --- a/src/result.rs +++ b/src/result.rs @@ -59,6 +59,8 @@ impl ResultExt for Result { } } +/// Generates a match block which returns errors to circumvent rust borrow checker defects. +#[macro_export] macro_rules! try_res { ($value: expr => |$e: ident| $err: expr) => { match $value { @@ -68,6 +70,8 @@ macro_rules! try_res { }; } +/// Generates a match block which returns errors to circumvent rust borrow checker defects. +#[macro_export] macro_rules! try_opt { ($value: expr => $err: expr) => { match $value {