pub struct Header { /* private fields */ }
Expand description
A packet’s header.
See Section 4.2 of RFC 4880 for details.
Implementations
sourceimpl Header
impl Header
sourcepub fn new(ctb: CTB, length: BodyLength) -> Self
pub fn new(ctb: CTB, length: BodyLength) -> Self
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<()>
pub fn valid(&self, future_compatible: bool) -> Result<()>
Checks the header for validity.
A header is consider invalid if:
- The tag is
Tag::Reserved
. - The tag is
Tag::Unknown
orTag::Private
andfuture_compatible
is false. - The length encoding is invalid for the packet (e.g.,
partial body encoding may not be used for
PKESK
packets) - The lengths are unreasonable for a packet (e.g., a
PKESK
orSKESK
larger than 10 KB).
Trait Implementations
sourceimpl MarshalInto for Header
impl MarshalInto for Header
sourcefn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
Computes the maximal length of the serialized representation. Read more
sourcefn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
Serializes into the given buffer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more