pub trait HydroModel: Send {
type Params: Serialize + for<'de> Deserialize<'de> + Clone + Send;
// Required methods
fn new(params: Self::Params) -> Self;
fn step(&mut self, forcing: &Forcing, dt_h: f64);
fn discharge(&self) -> f64;
fn state(&self) -> Value;
fn reset(&mut self);
fn name(&self) -> &'static str;
fn params(&self) -> &Self::Params;
fn params_mut(&mut self) -> &mut Self::Params;
}Expand description
The core trait every distributed hydrological model implements.
Each model owns its parameter struct (associated type Params) and its
internal state. The platform calls step() per time-step and reads
discharge() for the outflow hydrograph.
Required Associated Types§
Required Methods§
Sourcefn new(params: Self::Params) -> Self
fn new(params: Self::Params) -> Self
Construct a model instance with the given parameters (default state).
Sourcefn step(&mut self, forcing: &Forcing, dt_h: f64)
fn step(&mut self, forcing: &Forcing, dt_h: f64)
Advance one time-step given the forcing (precipitation, PET, temperature).
Sourcefn params_mut(&mut self) -> &mut Self::Params
fn params_mut(&mut self) -> &mut Self::Params
Mutable access to parameters (for calibration).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".