This is a template for creating a new Twine component in Rust using cargo-generate.
To scaffold a new component from this template, run:
cargo generate isentropic-dev/twine-component-template --name my-componentThe --name flag is optional.
If omitted, cargo-generate will prompt you for a project name.
After generation:
- Navigate to your new project directory:
cd my-component - Review
Cargo.tomlandsrc/lib.rs. - Run the included tests to confirm everything is set up correctly:
cargo test
The included Arithmetic component demonstrates how to define a Twine component with:
- Custom input and output types
- A configurable
scaleparameter - Idiomatic error handling using thiserror
- Basic unit tests
To create your own component:
- Use
src/lib.rsas a starting point, updating the types as needed. - Rewrite the
Componentimplementation to fit your use case. - Update or replace the tests to validate your component's behavior.
This template is licensed under the MIT License (see the included LICENSE file).
If you publish a project based on this template under your own name or with different licensing terms, remember to update the LICENSE file accordingly.