Expand description
Contains the macros try_or!
, try_or_else!
, try_opt_or!
and
try_opt_or_else!
. These are helper macros for unwrapping a Result
or an
Option
while returning early for Err
and None
values. The semantics
are similar to unwrap_or
and unwrap_or_else
.
If you want a try_opt!
macro, there’s already another crate (try_opt
)
for that.
Macros§
- try_
opt_ or - Unwraps an
Option
, returning the second parameter if the option isNone
. - try_
opt_ or_ else - Unwraps an
Option
. If the result isNone
, calls the function$or_fn
and returns its result. - try_or
- Helper macro for unwrapping
Result
values. Returns early with the value of the second parameter if the first parameter isErr
. - try_
or_ else - Unwraps a
Result
. If the result isErr
, calls the function$or_fn
with its value and returns early with its result.