A minimal test repository for testing the #[shards] procedural macros, particularly #[shard_param].
This repository contains a simple calculator shard that demonstrates:
#[derive(shards::shard)]- Main shard derive macro#[shard_info]- Shard metadata#[shard_param]- Parameter definition with types and descriptions#[shard_required]- Required fields handling#[shards::shard_impl]- Implementation macro
The Calculator shard takes an integer input and adds two parameterized values to it:
10 | Calculator(AddA: 5 AddB: 3) | Log ; outputs 18
AddA- First value to add (integer)AddB- Second value to add (integer)
cargo build --releaseThe build process will automatically place the compiled library in test/externals/:
- Windows:
calculator.dll - macOS:
calculator.dylib - Linux:
calculator.so
Run the test script with shards:
../shards/build/debug/shards test/test_calculator.shsOr from the shards repository:
./build/debug/shards ../shards-rust-test/test/test_calculator.shssrc/lib.rs- Main shard implementationbuild.rs- Build configuration for output pathstest/test_calculator.shs- Test script demonstrating usageCargo.toml- Rust project configuration