scientific-workflow
scientific-workflow provides Rust primitives for representing scientific
system states and building reproducible simulation workflows.
The crate currently focuses on SystemState: a fixed-layout, heterogeneous
state container whose schema is loaded from JSON. Concrete payloads move into
and out of a state without cloning, making the container suitable for large
arrays and tensors used in scientific calculations.
Features
- JSON-defined state fields with deterministic order and stable type tags.
- Dictionary-like typed access to heterogeneous Rust payloads.
- Clone-free payload insertion, in-place mutation, and owned extraction.
- Explicit deep cloning of complete states.
- Shared immutable state specifications.
- Integer and optional finite physical time coordinates.
- Strict template validation and semantic JSON round trips.
- Compatibility with owned scientific payloads such as
physics_in_paralleltensors.
Time-series storage, automatic chunking, and workflow dispatch are under active development and are not part of the published API described below.
Installation
Add the crate to a Rust project:
[]
= "0.1"
The crate uses Rust edition 2024 and requires Rust 1.85 or newer.
State Template
A program begins with a JSON template that declares every state field:
Field order defines the compact runtime slot order. The type value is a
stable serialization tag rather than a Rust type name.
Basic Usage
use ;
set consumes the supplied payload, and take returns that same owned
payload. Neither operation calls Clone. Calling SystemState::clone
explicitly deep-clones populated payloads so the two states can be mutated
independently.
Tensor Payloads
Any concrete type satisfying Any + Clone + Send can be stored. For example,
an application can use a dense physics_in_parallel tensor:
use ;
use ;
let spec = load?;
let mut state = spec.empty;
let mut population = zeros;
population.set;
population.set;
population.set;
state.set?;
let population = state.?;
The tensor crate is not a required runtime dependency of
scientific-workflow; applications select and register their own concrete
scientific payload types.
Testing
From the package directory:
The public integration suite loads an actual JSON template and exercises the
complete state lifecycle using physics_in_parallel tensor payloads.
License
Licensed under the MIT License.