Struct libp2p::gossipsub::protocol::GossipsubCodec [−][src]
pub struct GossipsubCodec { /* fields omitted */ }
Implementations
Trait Implementations
type Item = HandlerEvent
type Item = HandlerEvent
The type of items returned by decode
type Error = GossipsubHandlerError
type Error = GossipsubHandlerError
The type of decoding errors.
pub fn decode(
&mut self,
src: &mut BytesMut
) -> Result<Option<<GossipsubCodec as Decoder>::Item>, <GossipsubCodec as Decoder>::Error>
pub fn decode(
&mut self,
src: &mut BytesMut
) -> Result<Option<<GossipsubCodec as Decoder>::Item>, <GossipsubCodec as Decoder>::Error>
Decode an item from the src BytesMut
into an item
fn decode_eof(
&mut self,
src: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
fn decode_eof(
&mut self,
src: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
Called when the input stream reaches EOF, signaling a last attempt to decode Read more
type Item = Rpc
type Item = Rpc
The type of items consumed by encode
type Error = GossipsubHandlerError
type Error = GossipsubHandlerError
The type of encoding errors.
pub fn encode(
&mut self,
item: <GossipsubCodec as Encoder>::Item,
dst: &mut BytesMut
) -> Result<(), <GossipsubCodec as Encoder>::Error>
pub fn encode(
&mut self,
item: <GossipsubCodec as Encoder>::Item,
dst: &mut BytesMut
) -> Result<(), <GossipsubCodec as Encoder>::Error>
Encodes an item into the BytesMut
provided by dst.