diff options
Diffstat (limited to 'lib/src/gossip/msg.rs')
-rw-r--r-- | lib/src/gossip/msg.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/src/gossip/msg.rs b/lib/src/gossip/msg.rs new file mode 100644 index 0000000..8a6e6d2 --- /dev/null +++ b/lib/src/gossip/msg.rs @@ -0,0 +1,17 @@ +use anyhow::Result; + +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +pub enum GossipMessage { + CurrentProfileState { + peer_id: Vec<u8>, + cid: Vec<u8>, + }, +} + +impl GossipMessage { + pub(crate) fn into_bytes(self) -> Result<Vec<u8>> { + serde_json::to_string(&self) + .map(String::into_bytes) + .map_err(anyhow::Error::from) + } +} |