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:
-
#[cex]
proc macro attribute for functions/closures/let-bindings returning checked exceptions. -
Result!()
annotates the return type. -
ret!()
/throw!()
for control flow. -
#[ty_pat]
for "type as pattern"