2 unstable releases

0.4.1 Jun 18, 2023
0.1.0 May 25, 2023

#1819 in Procedural macros

Download history 10/week @ 2024-03-11 5/week @ 2024-03-18 27/week @ 2024-04-01 21/week @ 2024-04-08 20/week @ 2024-04-15 19/week @ 2024-04-22 26/week @ 2024-04-29 29/week @ 2024-05-06 19/week @ 2024-05-13 40/week @ 2024-05-20 23/week @ 2024-05-27 32/week @ 2024-06-03 19/week @ 2024-06-10 19/week @ 2024-06-17 37/week @ 2024-06-24

110 downloads per month
Used in 2 crates (via hs-bindgen-attribute)

MIT/Apache

9KB
79 lines

reflexive

A magical meta function that evaluate (at compile-time if used inside a macro which is the point of taking a TokenStream input) any Rust expr!

Example

use reflexive::Sandbox;
use quote::quote;

let test = Sandbox::new("calc").unwrap();
let x: u32 = test.eval(quote! { 2 + 2 }).unwrap();
assert!(x == 4);

This library indeed is not what would benefit the most your crate build time, but it was still design in mind with the will of caching sandbox compilation.

Acknowledgments

⚠️ This is still a working experiment, not yet production ready.

This project was part of a work assignment as an IOG contractor.

License

Licensed under either of Apache License, Version 2.0 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

~84KB