#[derive(Clone, Copy, Debug, Default)]
pub struct AsyncServerStatistics {
pub message_count: u16,
pub comm_error_count: u16,
pub exception_error_count: u16,
pub server_message_count: u16,
pub no_response_count: u16,
pub nak_count: u16,
pub busy_count: u16,
pub character_overrun_count: u16,
}
impl AsyncServerStatistics {
pub fn new() -> Self {
Self::default()
}
pub fn clear(&mut self) {
*self = Self::default();
}
pub fn clear_overrun(&mut self) {
self.character_overrun_count = 0;
}
pub(crate) fn increment_message_count(&mut self) {
self.message_count = self.message_count.saturating_add(1);
}
pub(crate) fn increment_comm_error_count(&mut self) {
self.comm_error_count = self.comm_error_count.saturating_add(1);
}
pub(crate) fn increment_exception_error_count(&mut self) {
self.exception_error_count = self.exception_error_count.saturating_add(1);
}
pub(crate) fn increment_server_message_count(&mut self) {
self.server_message_count = self.server_message_count.saturating_add(1);
}
pub(crate) fn increment_no_response_count(&mut self) {
self.no_response_count = self.no_response_count.saturating_add(1);
}
}