Skip to content

fragcolor-xyz/shards-rust-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shards Rust Test - Calculator Module

A minimal test repository for testing the #[shards] procedural macros, particularly #[shard_param].

Structure

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

Calculator Shard

The Calculator shard takes an integer input and adds two parameterized values to it:

10 | Calculator(AddA: 5 AddB: 3) | Log ; outputs 18

Parameters

  • AddA - First value to add (integer)
  • AddB - Second value to add (integer)

Building

cargo build --release

The build process will automatically place the compiled library in test/externals/:

  • Windows: calculator.dll
  • macOS: calculator.dylib
  • Linux: calculator.so

Testing

Run the test script with shards:

../shards/build/debug/shards test/test_calculator.shs

Or from the shards repository:

./build/debug/shards ../shards-rust-test/test/test_calculator.shs

Files

  • src/lib.rs - Main shard implementation
  • build.rs - Build configuration for output paths
  • test/test_calculator.shs - Test script demonstrating usage
  • Cargo.toml - Rust project configuration

About

Test of a rust shard module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages