feat(proto): add proto message trait
This commit is contained in:
parent
aa649769d2
commit
4a9bc44a0f
2 changed files with 6 additions and 0 deletions
|
|
@ -1 +1,2 @@
|
||||||
pub mod primitive;
|
pub mod primitive;
|
||||||
|
pub mod proto_message;
|
||||||
|
|
|
||||||
5
proto/src/message/proto_message.rs
Normal file
5
proto/src/message/proto_message.rs
Normal 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>;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue