pub struct DecodedPacket { /* private fields */ }Expand description
A syntactically decoded packet. Routing/admission is rechecked on every use. Fields are read-only so cached hashes cannot diverge from the parsed bytes.
Implementations§
Source§impl DecodedPacket
impl DecodedPacket
pub fn unpack(raw: &[u8]) -> Result<Self, PacketError>
Sourcepub fn unpack_owned(raw: Vec<u8>) -> Result<Self, PacketError>
pub fn unpack_owned(raw: Vec<u8>) -> Result<Self, PacketError>
Decode wire bytes the caller owns (copied once into shared bytes).
Decode shared wire bytes without copying them.
Sourcepub fn packet(&self) -> &RawPacket<PacketBytes>
pub fn packet(&self) -> &RawPacket<PacketBytes>
The decoded fields. Its packet_hash is zeroed when hashing was
deferred; read the hash through DecodedPacket::packet_hash.
Sourcepub fn packet_hash(&self) -> Option<&[u8; 32]>
pub fn packet_hash(&self) -> Option<&[u8; 32]>
The packet hash, unless TransportEngine::decode_inbound deferred it.
Auto Trait Implementations§
impl Forget for DecodedPacket
impl Freeze for DecodedPacket
impl RefUnwindSafe for DecodedPacket
impl Send for DecodedPacket
impl Sync for DecodedPacket
impl Unpin for DecodedPacket
impl UnsafeUnpin for DecodedPacket
impl UnwindSafe for DecodedPacket
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