Snap Pea
The P modeling language in Rust: a parser, type checker and model checker with no .NET, Java or code generation, plus helpers to check the events your application emits against P specs.
The snappea tool
snappea-compat is a drop-in replacement for upstream's p command.
Library
cargo add --dev snappea for tests. Production code needs only the emitter:
[]
= { = "0.1", = false, = ["emit"] }
[]
= "0.1"
// Application code. With only the `emit` feature, no checker is compiled in.
emit;
// A test: everything emitted while the closure runs is checked against the P specs
// configured in [package.metadata.snappea] of Cargo.toml.
let model = load?;
model.check;
| Feature | Adds |
|---|---|
emit |
snappea::emit: emit events to tests, SNAPPEA_EVENTS_DIR or production logs. Depends only on serde and serde_json. |
test (default) |
snappea::test: in-process checks in #[test]s. Implies emit. |
cli (default) |
The snappea and snappea-compat binaries. |
test and cli also expose the checker as a library: snappea::syntax, snappea::sema,
snappea::checker, snappea::project and snappea::driver.
Documentation
- The repository:
snappeausage and compatibility with upstream P - Rust inventory examples
- Testing and production
- Checking logs with
snappea observe - The checker as a library
License
MIT or Apache-2.0, at your option.