#compile-time-reflection #jit-compiler #forms #alignment #run-time

static-reflect

Static type information, giving a form of compile-time reflection

19 releases

0.2.0-alpha.9 Jul 9, 2025
0.2.0-alpha.8 Jul 14, 2024
0.2.0-alpha.6 Dec 20, 2021
0.2.0-alpha.3 Nov 6, 2021
0.1.0 Apr 20, 2021

#279 in Programming languages

Download history 2/week @ 2025-07-21 1/week @ 2025-08-18 1/week @ 2025-09-01 1/week @ 2025-09-22

842 downloads per month
Used in static-reflect-derive

MIT/Apache

61KB
1K SLoC

rust-static-reflect

Compile-time reflection in rust!

The original use case is type-checking generated code in a JIT compiler (with zero runtime cost). However, other use cases are certainly possible :)

Contributions are welcome! I'd be happy to add more features as long as they align with the general philosophy of compile-time reflection.

Unfortunately, there is very little documentation right now. Hopefully, that will change in the future.

  • facet - Very similar, much more recent, appears very high quality. Unsound: Does not require #[repr(C)] to manipulate type layout.
  • const-type-layout - Similar, but far more complex use of type system. Requires specialization and many other nightly features.

License

Licensed under either the Apache 2.0 License or MIT License at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~125–435KB