#struct-fields #field #macro #iterator #proc-macro #generate

macro metastruct_macro

Abstractions for iterating and mapping over struct fields (proc macro crate)

4 releases

0.1.3 Nov 22, 2024
0.1.2 Jul 18, 2024
0.1.1 Jun 19, 2023
0.1.0 Dec 8, 2022

#131 in #struct-fields

Download history 1948/week @ 2024-08-12 2368/week @ 2024-08-19 2493/week @ 2024-08-26 2082/week @ 2024-09-02 1580/week @ 2024-09-09 1930/week @ 2024-09-16 1693/week @ 2024-09-23 1522/week @ 2024-09-30 1552/week @ 2024-10-07 2647/week @ 2024-10-14 1777/week @ 2024-10-21 2137/week @ 2024-10-28 1153/week @ 2024-11-04 761/week @ 2024-11-11 1595/week @ 2024-11-18 1990/week @ 2024-11-25

5,578 downloads per month
Used in metastruct

Apache-2.0

18KB
412 lines

metastruct

Metastruct is Rust library for metaprogramming with struct fields.

Some of the things you can do with metastruct include:

  • Iterate over a struct's fields.
  • Map a closure over all or some of a struct's fields.
  • Access the number of fields in a struct at compile-time via a const.

This is achieved by a procedural macro, which generates macro_rules! macros.

One way of understanding metastruct is as a shortcut to writing your own derive macros. If you have a trait that you'd like to implement on a one-off basis, metastruct can help you write that implementation without a derive macro.

🚧 Under Construction 🚧

This library is currently under construction and should not be considered stable.

There's currently no documentation aside from a few scant code comments and examples/tests.

License

Apache 2.0

Dependencies

~2.5MB
~54K SLoC