Checked exception

This library simulates checked exception by enumerating in function's signatures every possible error types in ad-hoc enums which are Exchange-able and matched their variants' types as patterns.

Usage

Add this crate to Cargo.toml, and enable any feature you want

Cargo.toml:

enumx = "0.4"
cex = "0.5"

src/lib.rs:


#![allow(unused)]
fn main() {
use enumx::export::*;
use enumx::predefined::*; // or use your own enum types at your will.
use cex::*;
}

Extended syntax:

  1. #[cex] proc macro attribute for functions/closures/let-bindings returning checked exceptions.

  2. Result!() annotates the return type.

  3. ret!()/throw!() for control flow.

  4. #[ty_pat] for "type as pattern"