Skip to main content

looprs_core/adapters/
null_output.rs

1//! NullOutput adapter — a no-op `UserOutput` for tests and embedded use.
2
3use crate::ports::UserOutput;
4
5/// Discards all output. Use in tests where UI side-effects are unwanted.
6pub struct NullOutput;
7
8impl UserOutput for NullOutput {
9    fn info(&self, _msg: &str) {}
10    fn warn(&self, _msg: &str) {}
11    fn error(&self, _msg: &str) {}
12    fn assistant_text(&self, _text: &str) {}
13    fn tool_call(&self, _tool_name: &str, _input_preview: &str) {}
14    fn tool_ok(&self) {}
15    fn tool_err(&self, _err_msg: &str) {}
16}
17
18#[cfg(test)]
19mod tests {
20    use super::*;
21
22    #[test]
23    fn conformance() {
24        crate::ports::test_contracts::assert_user_output_contract(&NullOutput);
25    }
26}