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

metastruct

Abstractions for iterating and mapping over struct fields

3 releases

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

#272 in Rust patterns

Download history 2727/week @ 2024-07-18 2278/week @ 2024-07-25 1617/week @ 2024-08-01 1979/week @ 2024-08-08 2192/week @ 2024-08-15 2552/week @ 2024-08-22 2099/week @ 2024-08-29 2088/week @ 2024-09-05 1492/week @ 2024-09-12 1893/week @ 2024-09-19 1298/week @ 2024-09-26 1735/week @ 2024-10-03 2111/week @ 2024-10-10 2458/week @ 2024-10-17 1744/week @ 2024-10-24 1473/week @ 2024-10-31

8,052 downloads per month

Apache-2.0

4KB

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

~0–355KB