use super::{
GateActuatorBatch, GateActuatorOutput, GateActuatorState, GateActuatorStepDiagnostics,
};
use crate::structures::StructureError;
use numr::dtype::DType;
use numr::runtime::Runtime;
#[derive(Clone, Debug)]
pub struct GateActuatorTrial<R: Runtime<DType = DType>> {
pub(crate) next: GateActuatorBatch<R>,
}
impl<R: Runtime<DType = DType>> GateActuatorTrial<R> {
pub fn outputs(&self) -> Result<Vec<GateActuatorOutput>, StructureError> {
self.next.outputs()
}
pub fn states(&self) -> Result<Vec<GateActuatorState>, StructureError> {
self.next.states()
}
pub fn diagnostics(&self) -> Result<GateActuatorStepDiagnostics, StructureError> {
self.next.last_step()?.ok_or_else(|| {
StructureError::numerical("actuator trial lacks its immediate step receipt")
})
}
pub fn into_next(self) -> GateActuatorBatch<R> {
self.next
}
}