pub struct Header { /* private fields */ }Expand description
A packet’s header.
See Section 4.2 of RFC 9580 for details.
Implementations§
Source§impl Header
impl Header
Sourcepub fn new(ctb: CTB, length: BodyLength) -> Header
pub fn new(ctb: CTB, length: BodyLength) -> Header
Creates a new header.
Sourcepub fn length(&self) -> &BodyLength
pub fn length(&self) -> &BodyLength
Returns the header’s length.
Sourcepub fn valid(&self, future_compatible: bool) -> Result<(), Error>
pub fn valid(&self, future_compatible: bool) -> Result<(), Error>
Checks the header for validity.
A header is considered invalid if:
- The tag is
Tag::Reserved. - The tag is
Tag::UnknownorTag::Privateandfuture_compatibleis false. - The length encoding is invalid for the packet (e.g.,
partial body encoding may not be used for
PKESKpackets) - The lengths are unreasonable for a packet (e.g., a
PKESKorSKESKlarger than 10 KB).
Trait Implementations§
Source§impl MarshalInto for Header
impl MarshalInto for Header
Source§fn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
Computes the maximal length of the serialized representation. Read more
Source§fn serialize_into(&self, buf: &mut [u8]) -> Result<usize, Error>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize, Error>
Serializes into the given buffer. Read more
Source§impl<'a> Parse<'a, Header> for Header
impl<'a> Parse<'a, Header> for Header
Source§fn from_buffered_reader<R>(reader: R) -> Result<Header, Error>where
R: BufferedReader<Cookie> + 'a,
fn from_buffered_reader<R>(reader: R) -> Result<Header, Error>where
R: BufferedReader<Cookie> + 'a,
Reads from the given buffered reader. Read more
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnsafeUnpin for Header
impl UnwindSafe for Header
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,
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