#exception #error #throws #ad-hoc #anonymous

macro cex_derive

Macros for checked exception simulation

10 releases (5 breaking)

0.5.2 Apr 4, 2021
0.5.1 Feb 18, 2021
0.5.0 Nov 2, 2020
0.4.0 Jun 28, 2020
0.1.0 Nov 21, 2018

#7 in #ad-hoc

Download history 11/week @ 2023-01-20 13/week @ 2023-01-27 4/week @ 2023-02-03 34/week @ 2023-02-10 48/week @ 2023-02-17 6/week @ 2023-03-03 14/week @ 2023-03-10 37/week @ 2023-03-17 6/week @ 2023-03-24 24/week @ 2023-03-31 42/week @ 2023-04-07 3/week @ 2023-04-14 6/week @ 2023-04-21 23/week @ 2023-04-28 50/week @ 2023-05-05

83 downloads per month
Used in 3 crates (via cex)

MIT license

36KB
624 lines

The cex_derive crate provides the proc-macro implementation for the cex crate.

See cex crate's doc ../cex/README.md for more.

Licensed under MIT.


lib.rs:

This crate is the proc-macro implementation for cex crate.

Features

  • Result!( OkType throws A,B,... ) which is equivalant to Result<OkType, enumx::Enum!(A,B,...)>

  • ret!() Ok Type or Result

  • throw!() Error Types listed in throws

  • #[ty_pat] match, which enables "using types as patterns in match arms".

  • #[cex] let local_var: pattern = expression;, which enables all the mentioned features in the expression, e.g try blocks.

  • #[cex] on closures, which enables all the mentioned features in the closure.

  • #[cex] fn, which enables all the mentioned features in the function.

  • cex::Logger derive for enum.

See more details in cex crate's documents.

Dependencies

~1.2–1.7MB
~39K SLoC