macro_rules! define_hint_string_map {
($hint_set_name:ident, $(($hint_name:ident, $hint_str:expr $(, $feature_gate:expr)?)),+) => { ... };
}
Expand description
Generates a const string for each hint, and a lazy_static HashMap that maps the const name to the hint string. Allows gating specific hints behind feature gates.
ยงExamples
cairo_vm::define_hint_string_map!(
FOO_HINTS,
(FOO_HINT_ADD_X_Y, "x + y"),
(FOO_HINT_PRINT_X, "print(x)", "test_utils")
);
This will generate the following code:
pub const FOO_HINT_ADD_X_Y: &str = "x + y";
#[cfg(feature = "test_utils")]
pub const FOO_HINT_PRINT_X: &str = "print(x)";
lazy_static::lazy_static! {
pub static ref FOO_HINTS: HashMap<&'static str, &'static str> = {
let mut map = HashMap::new();
map.insert("FOO_HINT_ADD_X_Y", FOO_HINT_ADD_X_Y);
#[cfg(feature = "test_utils")]
map.insert("FOO_HINT_PRINT_X", FOO_HINT_PRINT_X);
map
};
}