use super::types::{DllError, NmtAction};
pub trait ErrorHandler {
fn log_error(&mut self, error: &DllError);
}
pub struct NoOpErrorHandler;
impl ErrorHandler for NoOpErrorHandler {
fn log_error(&mut self, _error: &DllError) {}
}
#[cfg(feature = "std")]
pub struct StdoutErrorHandler;
#[cfg(feature = "std")]
impl ErrorHandler for StdoutErrorHandler {
fn log_error(&mut self, error: &DllError) {
println!("[POWERLINK DLL ERROR]: {:?}", error);
}
}
pub trait ErrorCounters: Sized {
fn on_cycle_complete(&mut self);
fn handle_error<H: ErrorHandler>(&mut self, error: DllError, handler: &mut H) -> NmtAction;
}