use std::io::{Read, Write};
use std::any::Any;
pub trait Parsable {
fn parse(reader: &mut dyn Read) -> std::io::Result<Self> where Self: Sized;
fn dump(&self, writer: &mut dyn Write) -> std::io::Result<usize>;
}
pub trait SerializedEntityDescriptor: Parsable {
fn serialized_components() -> u8 where Self: Sized;
fn components<'a>(&'a self) -> Vec<&'a dyn SerializedEntityComponent>;
fn components_mut<'a>(&'a mut self) -> Vec<&'a mut dyn SerializedEntityComponent>;
fn hash_name(&self) -> u32;
fn hash(s: &str) -> u32 where Self: Sized {
crate::techblox::hashname(s)
}
}
pub trait SerializedEntityComponent: Parsable + Any {
fn size() -> usize where Self: Sized {
std::mem::size_of::<Self>()
}
}