#throw #exception #anonymous #error #ad-hoc

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

#21 in #throw

Download history 17/week @ 2024-03-11 19/week @ 2024-03-18 14/week @ 2024-03-25 33/week @ 2024-04-01 19/week @ 2024-04-08 10/week @ 2024-04-15 25/week @ 2024-04-22 21/week @ 2024-04-29 7/week @ 2024-05-06 18/week @ 2024-05-13 27/week @ 2024-05-20 16/week @ 2024-05-27 16/week @ 2024-06-03 21/week @ 2024-06-10 17/week @ 2024-06-17 26/week @ 2024-06-24

80 downloads per month
Used in 5 crates (via cex)

MIT license

37KB
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

~2.5MB
~51K SLoC