Enum sequoia_openpgp::packet::prelude::Body[][src]

pub enum Body {
    Unprocessed(Vec<u8>),
    Processed(Vec<u8>),
    Structured(Vec<Packet>),
}

A packet’s body holds either unprocessed bytes, processed bytes, or packets.

We conceptually divide packets into two parts: the header and the body. Whereas the header is read eagerly when the packet is deserialized, the body is only read on demand.

A packet’s body is stored here either when configured via PacketParserBuilder::buffer_unread_content, when one of the PacketPile deserialization routines is used, or on demand for a particular packet using the PacketParser::buffer_unread_content method.

There are three different types of packets:

  • Packets like the UserID and Signature packets, don’t actually have a body.
  • One packet, the literal data packet, includes unstructured data. That data is stored in Literal.
  • Some packets are containers. If the parser does not parse the packet’s child, either because the caller used PacketParser::next to get the next packet, or the maximum recursion depth was reached, then the packets can be stored here as a byte stream. (If the caller so chooses, the content can be parsed later using the regular deserialization routines, since the content is just an OpenPGP message.)

Variants

Unprocessed(Vec<u8>)

Unprocessed packet body.

The body has not been processed, i.e. it is still encrypted.

Note: if some of a packet’s data is streamed, and the PacketParser is configured to buffer unread content, then this is not the packet’s entire content; it is just the unread content.

Processed(Vec<u8>)

Processed packed body.

The body has been processed, i.e. decompressed or decrypted, but not parsed into packets.

Note: if some of a packet’s data is streamed, and the PacketParser is configured to buffer unread content, then this is not the packet’s entire content; it is just the unread content.

Structured(Vec<Packet>)

Parsed packet body.

Used by container packets (such as the encryption and compression packets) to reference their immediate children. This results in a tree structure.

This is automatically populated when using the PacketPile deserialization routines, e.g., PacketPile::from_file. By default, it is not automatically filled in by the PacketParser deserialization routines; this needs to be done manually.

Trait Implementations

impl Clone for Body[src]

fn clone(&self) -> Body[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Body[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl !RefUnwindSafe for Body

impl Send for Body

impl Sync for Body

impl Unpin for Body

impl !UnwindSafe for Body

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> DynClone for T where
    T: Clone
[src]

pub fn __clone_box(&self, Private) -> *mut ()[src]

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.