/ordoo

Primary LanguageRust

docs.rs

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.