#enums #error #proc-macro #deriving #docs #named-fields #derive-debug

macro foxerror

yet another proc macro for deriving Error on enums

1 unstable release

new 0.1.0 Jan 20, 2025

#638 in Procedural macros

MIT license

9KB
184 lines

derive macro for implementing Display and Error on enums

#[derive(Debug, foxerror::FoxError)]
enum Error {
    NamedFields { a: i32, b: i32 },
    #[err(msg = "a custom message")]
    WithMessage(String),
    /// or the first line of the doc comment
    DocWorksToo,
}

Dependencies

~235–690KB
~16K SLoC