#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 3/week @ 2023-11-20 11/week @ 2023-11-27 2/week @ 2024-01-15 2/week @ 2024-02-12 18/week @ 2024-02-19 143/week @ 2024-02-26 31/week @ 2024-03-04

194 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
~48K SLoC