Skip to main content

hydr_structures/structures/actuator/
trial.rs

1//! Ownership-based acceptance of complete candidate actuator state.
2
3use super::{
4    GateActuatorBatch, GateActuatorOutput, GateActuatorState, GateActuatorStepDiagnostics,
5};
6use crate::structures::StructureError;
7use numr::dtype::DType;
8use numr::runtime::Runtime;
9
10/// Immutable complete candidate. Dropping it preserves every accepted value.
11#[derive(Clone, Debug)]
12pub struct GateActuatorTrial<R: Runtime<DType = DType>> {
13    pub(crate) next: GateActuatorBatch<R>,
14}
15impl<R: Runtime<DType = DType>> GateActuatorTrial<R> {
16    /// Explicitly project candidate actual opening, support, and effective arrival bounds.
17    pub fn outputs(&self) -> Result<Vec<GateActuatorOutput>, StructureError> {
18        self.next.outputs()
19    }
20    /// Explicitly project complete candidate continuation values.
21    pub fn states(&self) -> Result<Vec<GateActuatorState>, StructureError> {
22        self.next.states()
23    }
24    /// Explicitly project the candidate interval and bounded original-input receipts.
25    pub fn diagnostics(&self) -> Result<GateActuatorStepDiagnostics, StructureError> {
26        self.next.last_step()?.ok_or_else(|| {
27            StructureError::numerical("actuator trial lacks its immediate step receipt")
28        })
29    }
30    /// Accept the complete candidate by ownership without projecting numerical state.
31    pub fn into_next(self) -> GateActuatorBatch<R> {
32        self.next
33    }
34}