| Crates.io | hydro2-operator |
| lib.rs | hydro2-operator |
| version | 0.1.0 |
| created_at | 2025-02-28 05:59:27.645146+00 |
| updated_at | 2025-02-28 05:59:27.645146+00 |
| description | Core interfaces, traits, and error handling for creating and running Hydro2 operators, including multi-port type conversion utilities. |
| homepage | |
| repository | https://github.com/klebs6/klebs-general |
| max_upload_size | |
| id | 1572490 |
| size | 102,620 |
hydro2-operator provides the core interfaces, traits, and error types for building and executing operators in a Hydro2 pipeline. Operators consume up to four input "ports" and produce up to four outputs; by conforming to the provided Operator trait, they can be assembled into larger dataflow networks. The crate supports compile-time type-checking of operator inputs/outputs and implements runtime bridging for more flexible wiring.
Operator<NetworkItem>: Defines how an operator processes up to four inputs to produce up to four outputs, including information on input/output port count, port type strings, port connection requirements, and an asynchronous execute(...) method.OperatorSignature: Associates up to four input types and four output types to a specific operator. Any user-defined operator implementing Operator usually also implements or references an OperatorSignature.PortTryIntoN<T> and PortTryFromN<T>: Type conversion traits that attach a "port index" context to the conversions. Operators declare how data is read from or written to each port via these traits.PortTryIntoNAny: Enables an operator to convert data into an "erased" container, facilitating uniform handling of multiple possible types.OpCode: General trait (or interface) for enumerating operator codes (e.g., for logging or identifying distinct transformations in the pipeline).NetworkError: Comprehensive error enumeration for all potential failures in operator creation, graph construction, and execution. This includes resource exhaustion, invalid port assignments, operator task panics, etc.#[async_trait]: Allows each operator to define async fn execute(...) for asynchronous dataflow, integrating well with async runtimes.Arc<dyn Operator<...>>: The IntoArcOperator trait easily boxes up your operators into a trait object that can be managed by the Hydro2 runtime.Add the following to your dependencies:
[dependencies]
hydro2-operator = "0.1"
Then, import and implement the Operator trait for your custom transformations, specifying how each input is handled and how outputs are produced.
Distributed under the OGPv1 License (see ogp-license-text crate for more details).