Param
Param<T> is a read-only dataset wrapper for configuration values. It is the primary way to pass parameters into pipeline nodes.
Definition
#[derive(Debug, Serialize, Deserialize)]
pub struct Param<T: Clone>(pub T);
impl<T: Clone + Serialize> Dataset for Param<T> {
type LoadItem = T;
type SaveItem = Never; // uninhabited
type Error = PondError;
fn load(&self) -> Result<T, PondError> { Ok(self.0.clone()) }
fn save(&self, output: Never) -> Result<(), PondError> { match output {} }
fn is_param(&self) -> bool { true }
}
Key properties:
- Loading always succeeds —
load()never returnsErr. The declaredErrorisPondErrorrather thanInfallible: a node’s input tuple requiresE: From<D::Error>of every slot, and aParamappears in nearly every pipeline, soInfalliblewould make every user error type owe aFrom<Infallible>impl - Writing is forbidden at compile time —
SaveItemisNever, an uninhabited type. A node whose output tuple contains a&Param<T>does not compile, because its function would have to produce a value that cannot exist.save()discharges its argument withmatch output {}— no runtime code, no panic is_param()returnstrue— used by the validator and visualization to distinguish params from data
Usage
#[derive(Serialize, Deserialize)]
struct Params {
threshold: Param<f64>,
max_retries: Param<u32>,
}
Node {
name: "filter",
input: (&cat.value, ¶ms.threshold),
output: (&cat.passed,),
func: |value: f64, threshold: f64| {
(value >= threshold,)
},
}
YAML
threshold: 0.5
max_retries: 3
Param<T> deserializes directly from the YAML value — no wrapping object needed.
Visualization
In the viz dashboard, parameters appear as distinct node shapes, separate from datasets. They are also shown in the left panel’s “Parameters” section.
no_std
Param is available in no_std — it requires no feature flags and uses no allocation.