Skip to main content

Crate hax_rust_engine_macros

Crate hax_rust_engine_macros 

Source
Expand description

Helper crate providing procedural macros for the Rust engine of hax.

Currently it provides the following.

  • Macros for deriving groups of traits. Most of the type from the AST have the same bounds, so that helps deduplicating a lot. Also, the fact those derive groups are named is helpful: for instance for code generation a simple use derive_group_for_ast_base as derive_group_for_ast can change what is to be derived without any attribute manipulation.

Attribute Macrosยง

derive_group_for_ast
Derive the common derives for the hax engine AST. This is a equivalent to derive_group_for_ast_serialization and derive_group_for_ast_base.
derive_group_for_ast_base
Derive the basic necessary traits for nodes in the AST.
derive_group_for_ast_serialization
Derive the necessary (de)serialization related traits for nodes in the AST.
partial_apply
An attribute procedural macro that creates a new macro_rules! definition by partially applying an existing macro or function with a given token stream.
prepend_associated_functions_with
Prepend the body any associated function with the given attribute payload.
replace
Replaces all occurrences of an identifier within the attached item.
setup_error_handling_struct
Adds a new field with a fresh name to an existing struct type definition. The new field contains error handling and span information to be used with a visitor. This macro will also derive implementations of hax_rust_engine::ast::visitors::wrappers::VisitorWithErrors and hax_rust_engine::ast::HasSpan for the struct.
setup_printer_struct
Adds a new field with a fresh name to an existing struct type definition. The new field contains span information to be used with a printer. This macro will also derive implementations of hax_rust_engine::printer::pretty_ast::HasContextualSpan for the struct.