1 unstable release

0.1.0 Dec 26, 2021

#22 in #typemap


Used in 2 crates

Unlicense

23KB
462 lines

fixed_typemap

GitHub Actions docs.rs GitHub Sponsors

Implements typemaps that support a lot of extra funcctionality using procedural macros. docs.rs has a lot more than this readme, including a mini-tutorial and worked example. You can use this to:

  • Implement fixed typemaps which don't allocate, and store all their members inline initialized to default values.
  • Use this to implement something like the fields-in-traits proposal, where you "name" fields generically using types.
  • Generate iteration helpers which can iterate over the typemap as trait objects for any number of traits (e.g. this can replace HashMap<TypeId, Box<dyn MyTrait>>, bringing the rest of the functionality along for the ride and also let you do as many traits as you want at once).
  • Add an optional dynamic section which uses a HashMap to enable storing any type.

no_std support is WIP in the sense that it's basically done but I don't know enough to reliably finish it. Doing so shouldn't be hard and I'm very open to contributions which do so and preferrably provide CI configuration.

Dependencies

~2MB
~43K SLoC