1 unstable release
0.1.0 | Nov 28, 2024 |
---|
#1769 in Rust patterns
134 downloads per month
6KB
okk
This crate is yet another approach to replacing Ok(())
across the code, following the idea discussed in this IRLO thread.
Use case
This crate provides a function ok()
and a macro ok!()
, both can be used to replace Ok(())
, and so you can write only one pair of parentheses:
use okk::*;
struct MyError;
fn try_foo() -> Result<(), MyError> {
// ...
ok()
}
fn try_bar() -> Result<(), MyError> {
// ...
ok!()
}