antlion

Crates.ioantlion
lib.rsantlion
version0.3.2
sourcesrc
created_at2022-10-22 09:40:23.473411
updated_at2023-05-26 09:55:48.346457
descriptionHandy way to evaluate at compile-time any Rust expression
homepage
repositoryhttps://github.com/yvan-sraka/antlion
max_upload_size
id694313
size23,044
Yvan Sraka (yvan-sraka)

documentation

README

antlion

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 antlion::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.

Commit count: 11

cargo fmt