pub struct PartialPacket<S: SphinxSuite, H: SphinxHeaderSpec> { /* private fields */ }
Expand description
Represents a packet that is only partially instantiated, that is - it contains only the routing information and the Alpha value.
This object can be used to pre-compute a packet without a payload
and possibly serialize it, and later to be
deserialized and used to construct the final MetaPacket
via
a call to PartialPacket::into_meta_packet
.
Implementations§
Source§impl<S: SphinxSuite, H: SphinxHeaderSpec> PartialPacket<S, H>
impl<S: SphinxSuite, H: SphinxHeaderSpec> PartialPacket<S, H>
Sourcepub fn new<M: KeyIdMapper<S, H>>(
routing: MetaPacketRouting<'_, S, H>,
key_mapper: &M,
) -> Result<Self, SphinxError>
pub fn new<M: KeyIdMapper<S, H>>( routing: MetaPacketRouting<'_, S, H>, key_mapper: &M, ) -> Result<Self, SphinxError>
Creates a new partial packet using the given routing information and public key identifier mapper.
Sourcepub fn into_meta_packet<const P: usize>(
self,
payload: PaddedPayload<P>,
) -> MetaPacket<S, H, P>
pub fn into_meta_packet<const P: usize>( self, payload: PaddedPayload<P>, ) -> MetaPacket<S, H, P>
Transform this partial packet into an actual MetaPacket
using the given payload.
Trait Implementations§
Source§impl<S: SphinxSuite, H: SphinxHeaderSpec> Clone for PartialPacket<S, H>
impl<S: SphinxSuite, H: SphinxHeaderSpec> Clone for PartialPacket<S, H>
Source§impl<S: SphinxSuite, H: SphinxHeaderSpec> Debug for PartialPacket<S, H>
impl<S: SphinxSuite, H: SphinxHeaderSpec> Debug for PartialPacket<S, H>
Source§impl<'de, S: SphinxSuite, H> Deserialize<'de> for PartialPacket<S, H>where
H: Deserialize<'de> + SphinxHeaderSpec,
impl<'de, S: SphinxSuite, H> Deserialize<'de> for PartialPacket<S, H>where
H: Deserialize<'de> + SphinxHeaderSpec,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<S: SphinxSuite, H: SphinxHeaderSpec> PartialEq for PartialPacket<S, H>
impl<S: SphinxSuite, H: SphinxHeaderSpec> PartialEq for PartialPacket<S, H>
Source§impl<S: SphinxSuite, H> Serialize for PartialPacket<S, H>where
H: Serialize + SphinxHeaderSpec,
impl<S: SphinxSuite, H> Serialize for PartialPacket<S, H>where
H: Serialize + SphinxHeaderSpec,
impl<S: SphinxSuite, H: SphinxHeaderSpec> Eq for PartialPacket<S, H>
Auto Trait Implementations§
impl<S, H> Freeze for PartialPacket<S, H>where
<<<S as SphinxSuite>::G as GroupElement<<S as SphinxSuite>::E>>::AlphaLen as ArrayLength>::ArrayType<u8>: Freeze,
impl<S, H> RefUnwindSafe for PartialPacket<S, H>where
<<<S as SphinxSuite>::G as GroupElement<<S as SphinxSuite>::E>>::AlphaLen as ArrayLength>::ArrayType<u8>: RefUnwindSafe,
H: RefUnwindSafe,
<S as SphinxSuite>::PRP: RefUnwindSafe,
impl<S, H> Send for PartialPacket<S, H>
impl<S, H> Sync for PartialPacket<S, H>
impl<S, H> Unpin for PartialPacket<S, H>where
<<<S as SphinxSuite>::G as GroupElement<<S as SphinxSuite>::E>>::AlphaLen as ArrayLength>::ArrayType<u8>: Unpin,
H: Unpin,
<S as SphinxSuite>::PRP: Unpin,
impl<S, H> UnwindSafe for PartialPacket<S, H>where
<<<S as SphinxSuite>::G as GroupElement<<S as SphinxSuite>::E>>::AlphaLen as ArrayLength>::ArrayType<u8>: UnwindSafe,
H: UnwindSafe,
<S as SphinxSuite>::PRP: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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