okk

Crates.iookk
lib.rsokk
version0.1.0
sourcesrc
created_at2024-11-28 08:00:11.441041
updated_at2024-11-28 08:00:11.441041
descriptionYet another approach to replacing the `Ok(())`.
homepagehttps://github.com/Evian-Zhang/okk
repositoryhttps://github.com/Evian-Zhang/okk
max_upload_size
id1464025
size15,066
EvianZhang (Evian-Zhang)

documentation

https://docs.rs/okk

README

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!()
}
Commit count: 3

cargo fmt