Crates.io | ordoo |
lib.rs | ordoo |
version | 0.1.1 |
source | src |
created_at | 2023-09-27 23:31:45.120223 |
updated_at | 2023-09-27 23:40:19.364851 |
description | Macro to allow early exit of control flow in Options and Results |
homepage | |
repository | https://github.com/ttocsneb/ordoo |
max_upload_size | |
id | 985323 |
size | 4,276 |
This crate simply adds a macro that makes the syntax simpler to end control flow.
The macro or_do will allow you to return a function early if a value is None or Err.
use ordoo::or_do;
let val: i32 = or_do!(Some(1), return);
let val: i32 = or_do!(Ok::<_, std::io::Error>(1), _ => return);
I may add more QoL macros/functions later.