Struct sequoia_openpgp::packet::header::Header
source · pub struct Header { /* private fields */ }
Expand description
A packet’s header.
See Section 4.2 of RFC 4880 for details.
Implementations§
source§impl 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§
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>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
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<Self>where
R: BufferedReader<Cookie> + 'a,
fn from_buffered_reader<R>(reader: R) -> Result<Self>where
R: BufferedReader<Cookie> + 'a,
Reads from the given buffered reader.
source§fn from_reader<R: 'a + Read + Send + Sync>(reader: R) -> Result<Self>
fn from_reader<R: 'a + Read + Send + Sync>(reader: R) -> Result<Self>
Reads from the given reader.
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin 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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)