pub trait WritableSimulation {
// Required methods
fn net(&self) -> &Network;
fn snapshots(&self) -> &[HydSnapshot];
fn pump_energy_at(&self, link_index: usize) -> Option<&PumpEnergy>;
fn peak_demand_kw(&self) -> f64;
fn mass_balance(&self) -> Option<&MassBalance>;
fn warnings(&self) -> &[SimWarning];
fn pump_energy_by_id(&self, pump_id: &str) -> Option<&PumpEnergy>;
fn analysis_times(&self) -> (Option<SystemTime>, Option<SystemTime>);
fn flow_balance(&self) -> Option<&FlowBalance>;
fn flow_balance_summary(&self) -> Option<FlowBalanceSummary>;
}Expand description
Read-only view of a completed (or in-progress) simulation that the writers
need. Implemented by crate::simulation::Simulation.
The trait is intentionally narrow — it exposes only what the writers actually access, avoiding leaking internal solver state into the public API.
Required Methods§
Sourcefn snapshots(&self) -> &[HydSnapshot]
fn snapshots(&self) -> &[HydSnapshot]
All hydraulic snapshots stored during the simulation.
Sourcefn pump_energy_at(&self, link_index: usize) -> Option<&PumpEnergy>
fn pump_energy_at(&self, link_index: usize) -> Option<&PumpEnergy>
Pump energy record at link_index, or None if no accounting state is
available (e.g. hydraulics not yet run).
Sourcefn peak_demand_kw(&self) -> f64
fn peak_demand_kw(&self) -> f64
Peak simultaneous electrical demand across all pumps (kW).
Sourcefn mass_balance(&self) -> Option<&MassBalance>
fn mass_balance(&self) -> Option<&MassBalance>
Mass balance from the quality engine. None if quality not yet run.
Sourcefn warnings(&self) -> &[SimWarning]
fn warnings(&self) -> &[SimWarning]
Non-fatal diagnostics emitted during the simulation.
Sourcefn pump_energy_by_id(&self, pump_id: &str) -> Option<&PumpEnergy>
fn pump_energy_by_id(&self, pump_id: &str) -> Option<&PumpEnergy>
Look up a pump’s energy record by its string ID. Returns None if the
ID is unknown or the link is not a pump.
Sourcefn analysis_times(&self) -> (Option<SystemTime>, Option<SystemTime>)
fn analysis_times(&self) -> (Option<SystemTime>, Option<SystemTime>)
The hydraulic and quality analysis start and finish wall-clock times.
Sourcefn flow_balance(&self) -> Option<&FlowBalance>
fn flow_balance(&self) -> Option<&FlowBalance>
Flow balance from accounting. None if hydraulics not yet run.
Sourcefn flow_balance_summary(&self) -> Option<FlowBalanceSummary>
fn flow_balance_summary(&self) -> Option<FlowBalanceSummary>
Derived flow balance summary. None if hydraulics not yet run or
if the simulation lacks the data needed to compute final tank volume.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".