Skip to main content

pounce_algorithm/output/
trait.rs

1//! Iteration-output trait — port of `IpIterationOutput.hpp`.
2
3use crate::ipopt_cq::IpoptCqHandle;
4use crate::ipopt_data::IpoptDataHandle;
5
6/// Strategy that emits one row of the iter-by-iter table. The default
7/// `write_output` is a no-op so structural unit tests can drive the
8/// algorithm without an output sink. Phase 7 ports `OrigIterationOutput`
9/// with the full upstream column format.
10pub trait IterationOutput {
11    fn write_output(&mut self) {}
12
13    /// Format the next iteration row into a fresh `String`, given the
14    /// current data + CQ snapshots. Default returns an empty string.
15    /// Mirrors `IpOrigIterationOutput::WriteOutput` minus the
16    /// journalist write — callers route the returned line wherever
17    /// they want (stdout, file, log buffer for tests).
18    fn format_row(&mut self, _data: &IpoptDataHandle, _cq: &IpoptCqHandle) -> String {
19        String::new()
20    }
21}