| Crates.io | ppx |
| lib.rs | ppx |
| version | 0.4.0 |
| created_at | 2026-01-18 21:42:17.81375+00 |
| updated_at | 2026-01-25 08:37:24.450999+00 |
| description | C-style pre-processor library |
| homepage | |
| repository | https://github.com/Jomy10/ppx |
| max_upload_size | |
| id | 2053166 |
| size | 9,918 |
Small C-style macro expansion library.
let result = ppx::parse_string(
"
#param A
#define B hello
#define fn(name) name!
B A fn(John)
",
base_dir,
["world"].into_iter()
);
// result = "hello world John!"
More examples in the tests folder.
#param: A parameter that can be passed when including the file, or from the
parse* functions.#define: Define a simple substition, or a function-like macro#include: Include another file and parse it as well. Optionally accepts
parameters which will be used for substituting the names specified by #param.Optional features:
include_ppx! and include_ppx_string!: Parse a template at compile time
instead of at runtime. Enable macros with feature macro or macro-stable.vfs feature: allows using virtual filesystem from the vfs crate
as the input.planned
#ifBreaking canges will be introduced in minor versions as long as this crate has not reached 1.0.
Version 1.0 will be reached once #if has been implemented.
cargo test --workspace
Or better, with the cargo-all-features subcommand:
cargo +nightly all-features test --workspace
MIT or Apache-2.0.