use crate::{Result, WordType};
pub trait Header
where
Self: Sized + Into<WordType>,
{
fn count(&self) -> Option<usize>;
}
pub trait Word
where
Self: Sized + Into<WordType>,
{
fn new() -> Self;
fn with_value(self, data: u16) -> Self;
fn with_bytes(self, data: [u8; 2]) -> Self;
fn with_parity(self, parity: u8) -> Self;
fn with_calculated_parity(self) -> Self;
fn build(self) -> Result<Self>;
fn from_value(data: u16) -> Self;
fn from_bytes(data: [u8; 2]) -> Self;
fn as_bytes(&self) -> [u8; 2];
fn as_value(&self) -> u16;
fn set_bytes(&mut self, data: [u8; 2]);
fn set_value(&mut self, data: u16);
fn parity(&self) -> u8;
fn set_parity(&mut self, parity: u8);
fn calculate_parity(&self) -> u8;
fn check_parity(&self) -> bool;
}