use core::fmt::Debug;
use std::io::{self, Cursor};
use crate::header::DatabaseHeader;
pub mod category;
pub trait ExtraInfoRecord: Sized + Debug {
const SIZE: usize;
fn from_bytes(hdr: &DatabaseHeader, data: &mut Cursor<&[u8]>) -> Result<Self, io::Error>;
fn to_bytes(&self) -> Result<Vec<u8>, io::Error>;
fn data_empty(&self) -> bool;
fn data_item_categories(&self) -> Option<Vec<category::ExtraInfoCategory>> {
None
}
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct NullExtraInfo;
impl ExtraInfoRecord for NullExtraInfo {
const SIZE: usize = 0;
fn from_bytes(_hdr: &DatabaseHeader, _data: &mut Cursor<&[u8]>) -> Result<Self, io::Error> {
Ok(Self)
}
fn to_bytes(&self) -> Result<Vec<u8>, io::Error> {
Ok(Vec::new())
}
fn data_empty(&self) -> bool {
true
}
}