mod libtest;
use super::TestEvent;
use crate::errors::WriteEventError;
pub use libtest::{EmitNextestObject, LibtestReporter};
#[derive(Default)]
pub struct StructuredReporter<'a> {
libtest: Option<LibtestReporter<'a>>,
}
impl<'a> StructuredReporter<'a> {
pub fn new() -> Self {
Self::default()
}
pub fn set_libtest(&mut self, libtest: LibtestReporter<'a>) -> &mut Self {
self.libtest = Some(libtest);
self
}
#[inline]
pub(super) fn write_event(&mut self, event: &TestEvent<'a>) -> Result<(), WriteEventError> {
if let Some(libtest) = &mut self.libtest {
libtest.write_event(event)?;
}
Ok(())
}
}