use crate::coding::*;
#[derive(Clone, Debug)]
pub struct Announce {
pub broadcast: String,
}
impl Decode for Announce {
fn decode<R: bytes::Buf>(r: &mut R) -> Result<Self, DecodeError> {
let broadcast = String::decode(r)?;
Ok(Self { broadcast })
}
}
impl Encode for Announce {
fn encode<W: bytes::BufMut>(&self, w: &mut W) {
self.broadcast.encode(w)
}
}
#[derive(Clone, Debug)]
pub struct AnnounceInterest {
pub prefix: String,
}
impl Decode for AnnounceInterest {
fn decode<R: bytes::Buf>(r: &mut R) -> Result<Self, DecodeError> {
let prefix = String::decode(r)?;
Ok(Self { prefix })
}
}
impl Encode for AnnounceInterest {
fn encode<W: bytes::BufMut>(&self, w: &mut W) {
self.prefix.encode(w)
}
}