tryvial
A small crate for Ok-wrapping and try blocks.
This is compatible with Result
, Option
,
and any type implementing the unstable std::ops::Try
trait.
This crate does not require nightly Rust.
Overview
The macro try_fn
is used to perform Ok-wrapping on the return value of a function.
Before:
After:
The macro try_block
is an implementation of "try blocks" from nightly rust.
let result: = try_block! ;
The macro wrap_ok
simply wraps an expression with the "ok" variant for a given Try
type.
assert_eq!;
License
MIT or Apache-2.0