| Crates.io | okey |
| lib.rs | okey |
| version | 0.1.1 |
| created_at | 2024-02-13 21:30:47.668704+00 |
| updated_at | 2024-04-12 22:10:11.080383+00 |
| description | Everything is Result::Ok... |
| homepage | https://github.com/david-d-h/okey |
| repository | https://github.com/david-d-h/okey |
| max_upload_size | |
| id | 1138926 |
| size | 4,389 |
Ideally this crate should not be used used with the macro_rules_attribute
crate from Daniel Henry-Mantilla. So make sure to install that too...
cargo add macro_rules_attribute
#[macro_use]
extern crate macro_rules_attribute;
use okey::okey;
#[apply(okey)]
fn my_name() -> Result<&'static str> {
return "David";
}
In the example above my_name will automatically return a Result::Ok variant with "David" as it's inner value.
Note that this won't work with "implicit returns", you need to explicitly put the return keyword for this to work.
#[macro_use]
extern crate macro_rules_attribute;
use okey::okey;
#[apply(okey)]
fn my_name() -> Result<&'static str> {
return Err(some_error());
}