Crates.io | okk |
lib.rs | okk |
version | 0.1.0 |
source | src |
created_at | 2024-11-28 08:00:11.441041 |
updated_at | 2024-11-28 08:00:11.441041 |
description | Yet another approach to replacing the `Ok(())`. |
homepage | https://github.com/Evian-Zhang/okk |
repository | https://github.com/Evian-Zhang/okk |
max_upload_size | |
id | 1464025 |
size | 15,066 |
This crate is yet another approach to replacing Ok(())
across the code, following the idea discussed in this IRLO thread.
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!()
}