pub trait GossipsubCodec {
    type RequestMessage;
    type ResponseMessage;

    // Required methods
    fn encode(&self, data: Self::RequestMessage) -> Result<Vec<u8>, Error>;
    fn decode(
        &self,
        encoded_data: &[u8],
        gossipsub_topic: GossipTopicTag
    ) -> Result<Self::ResponseMessage, Error>;
}
Expand description

Implement this in order to handle serialization & deserialization of Gossipsub messages

Required Associated Types§

Required Methods§

source

fn encode(&self, data: Self::RequestMessage) -> Result<Vec<u8>, Error>

source

fn decode( &self, encoded_data: &[u8], gossipsub_topic: GossipTopicTag ) -> Result<Self::ResponseMessage, Error>

Implementors§

source§

impl GossipsubCodec for PostcardCodec

§

type RequestMessage = GossipsubBroadcastRequest

§

type ResponseMessage = GossipsubMessage