pub struct HoprDecoder<Chain, S, T> { /* private fields */ }Expand description
Default decoder implementation for HOPR packets.
Implementations§
Source§impl<Chain, S, T> HoprDecoder<Chain, S, T>where
Chain: ChainReadChannelOperations + ChainKeyOperations + ChainValues + Send + Sync,
S: SurbStore + Send + Sync,
T: TicketTracker + Send + Sync,
impl<Chain, S, T> HoprDecoder<Chain, S, T>where
Chain: ChainReadChannelOperations + ChainKeyOperations + ChainValues + Send + Sync,
S: SurbStore + Send + Sync,
T: TicketTracker + Send + Sync,
Sourcepub fn new(
(packet_key, chain_key): (OffchainKeypair, ChainKeypair),
chain_api: Chain,
surb_store: S,
tracker: T,
channels_dst: Hash,
cfg: HoprCodecConfig,
) -> Self
pub fn new( (packet_key, chain_key): (OffchainKeypair, ChainKeypair), chain_api: Chain, surb_store: S, tracker: T, channels_dst: Hash, cfg: HoprCodecConfig, ) -> Self
Creates a new instance of the decoder.
Trait Implementations§
Source§impl<Chain, S, T> PacketDecoder for HoprDecoder<Chain, S, T>where
Chain: ChainReadChannelOperations + ChainKeyOperations + ChainValues + Send + Sync,
S: SurbStore + Send + Sync + 'static,
T: TicketTracker + Send + Sync,
impl<Chain, S, T> PacketDecoder for HoprDecoder<Chain, S, T>where
Chain: ChainReadChannelOperations + ChainKeyOperations + ChainValues + Send + Sync,
S: SurbStore + Send + Sync + 'static,
T: TicketTracker + Send + Sync,
type Error = HoprProtocolError
Source§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,
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.Auto Trait Implementations§
impl<Chain, S, T> !Freeze for HoprDecoder<Chain, S, T>
impl<Chain, S, T> !RefUnwindSafe for HoprDecoder<Chain, S, T>
impl<Chain, S, T> Send for HoprDecoder<Chain, S, T>
impl<Chain, S, T> Sync for HoprDecoder<Chain, S, T>
impl<Chain, S, T> Unpin for HoprDecoder<Chain, S, T>
impl<Chain, S, T> !UnwindSafe for HoprDecoder<Chain, S, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more