use crate::asset::serialize::SerializedAsset;
pub trait AssetSerializationBackend: Send + Sync {
fn serialize(&self, asset: &SerializedAsset) -> anyhow::Result<Vec<u8>>;
fn deserialize(&self, bytes: &[u8]) -> anyhow::Result<SerializedAsset>;
}
pub struct NullSerializationBackend;
impl AssetSerializationBackend for NullSerializationBackend {
fn serialize(&self, _asset: &SerializedAsset) -> anyhow::Result<Vec<u8>> {
Err(anyhow::anyhow!(
"Unimplemented for NullSerializationBackend"
))
}
fn deserialize(&self, _bytes: &[u8]) -> anyhow::Result<SerializedAsset> {
Err(anyhow::anyhow!(
"Unimplemented for NullSerializationBackend"
))
}
}