| Crates.io | hydro2-network-wire-derive |
| lib.rs | hydro2-network-wire-derive |
| version | 0.1.0 |
| created_at | 2025-02-28 06:04:50.954632+00 |
| updated_at | 2025-02-28 06:04:50.954632+00 |
| description | A procedural macro providing #[derive(NetworkWire)] for bridging Hydro2 operator wires and enumerating operator IO variants. It automatically handles generics, type parameters, and attribute parsing to unify wire and operator definitions. |
| homepage | |
| repository | https://github.com/klebs6/klebs-general |
| max_upload_size | |
| id | 1572493 |
| size | 299,049 |
This crate provides a procedural macro named #[derive(NetworkWire)], which auto-generates the internal bridging and execution logic for a "wire" type in the Hydro2 operator framework. By combining information about the wire’s generics and a list of available operators (via an #[available_operators(op="...")] attribute), it automatically creates:
MyWireIO) to mirror each referenced operator’s types.#[derive(NetworkWire)]: Attach to a struct to generate:
enum (like MyWireIO) containing zero or more operator-IO variants.#[available_operators(op="FooOp", op="BarOp<Z>", ...)] on the wire struct to specify the set of operators the wire can handle.OpTy0, OPC1) as needed.When a struct uses:
#[available_operators(op="AddOp", op="ConstantOp<T>")]
#[derive(NetworkWire)]
pub struct MyWire<T> {
// ...
}
this macro will produce:
MyWireIO<T> with variants like AddOpIO(AddOpIO<T>), ConstantOpIO(ConstantOpIO<T>), and None.You can then rely on MyWireIO for operator graph constructions involving the listed operators.
Be sure to declare this crate in your Cargo.toml dependencies as:
[dependencies]
hydro2-network-wire-derive = "0.1"
Then, import and use the macro in your Rust code as needed.
Distributed under the OGPv1 License (see ogp-license-text crate for more details).