5 releases

0.1.4 Oct 27, 2024
0.1.3 Oct 27, 2024
0.1.2 Oct 27, 2024
0.1.1 Oct 27, 2024
0.1.0 Oct 27, 2024

#297 in Procedural macros

Download history 343/week @ 2024-10-26 31/week @ 2024-11-02

374 downloads per month

MIT/Apache

7KB
111 lines

enum_inject

Version info Downloads docs dependency status

example:

    use enum_inject::{enum_injector, EnumInjector};
    use display_enum::Display;
    #[derive(EnumInjector)]
    #[enum_injector({"args":[{"prefix":"A","suffix":"B","compute":{"Mul":1000}},{"prefix":"AA","suffix":"BB","compute":{"Mul":3000}}],"derives":["#[repr(i32)]","#[derive(Display)]"]})]
    enum Foo {
        #[skip]
        Test,
        #[sync_attr]
        B,
        C
    }

    #[test]
    fn test() {
        assert_eq!("ABB", Foo::ABB.to_string());
        assert_eq!(3000, Foo::AABBB as i32);
    }

Dependencies

~0.7–1.6MB
~34K SLoC