use crate::lang::types::TypeId;
use crate::wire::SerializationError;
use std::io::{Read, Write};
#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum WireOnly {
String,
Vec(TypeId),
Map(TypeId, TypeId),
Option(TypeId),
}
#[doc(hidden)]
#[macro_export]
macro_rules! bad_wire {
() => {
panic!("Called a wire method on a type that does not support wiring.")
};
}
pub unsafe trait WireIO {
fn write(&self, out: &mut impl Write) -> Result<(), SerializationError>;
fn read(input: &mut impl Read) -> Result<Self, SerializationError>
where
Self: Sized;
fn live_size(&self) -> usize;
}