feat(proto): add proto message trait

This commit is contained in:
Jindřich Moravec 2023-12-11 16:42:25 +01:00
parent aa649769d2
commit 4a9bc44a0f
2 changed files with 6 additions and 0 deletions

View file

@ -1 +1,2 @@
pub mod primitive; pub mod primitive;
pub mod proto_message;

View file

@ -0,0 +1,5 @@
pub trait ProtoMessage: Sized {
fn variant(&self) -> u8;
fn serialize(&self) -> anyhow::Result<Vec<u8>>;
fn deserialize(variant: u8, data: &[u8]) -> anyhow::Result<Self>;
}