pub trait PacketDecoder {
type Error: Error + Send + Sync + 'static;
// Required method
fn decode<'life0, 'async_trait>(
&'life0 self,
sender: PeerId,
data: Box<[u8]>,
) -> Pin<Box<dyn Future<Output = Result<IncomingPacket, IncomingPacketError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait defining decoder HOPR packets.
This operation is done directly by the packet processing pipeline after the underlying p2p transport hands over incoming data packets.
Required Associated Types§
Required Methods§
Sourcefn decode<'life0, 'async_trait>(
&'life0 self,
sender: PeerId,
data: Box<[u8]>,
) -> Pin<Box<dyn Future<Output = Result<IncomingPacket, IncomingPacketError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn decode<'life0, 'async_trait>(
&'life0 self,
sender: PeerId,
data: Box<[u8]>,
) -> Pin<Box<dyn Future<Output = Result<IncomingPacket, IncomingPacketError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Decodes the data received from the given sender
returns the corresponding IncomingPacket if the decoding into a HOPR packet was successful.