logo
pub enum BodyLength {
    Full(u32),
    Partial(u32),
    Indeterminate,
}
Expand description

A packet’s size.

A packet’s size can be expressed in three different ways. Either the size of the packet is fully known (Full), the packet is chunked using OpenPGP’s partial body encoding (Partial), or the packet extends to the end of the file (Indeterminate). See Section 4.2 of RFC 4880 for more details.

Variants

Full(u32)

The packet’s size is known.

Partial(u32)

The parameter is the number of bytes in the current chunk.

This type is only used with new format packets.

Indeterminate

The packet extends until an EOF is encountered.

This type is only used with old format packets.

Implementations

Emits the length encoded for use with old-style CTBs.

Note: the CTB itself is not emitted.

Errors

Returns Error::InvalidArgument if invoked on BodyLength::Partial. If you want to serialize a new-style length, use serialize(..).

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Emits the length encoded for use with new-style CTBs.

Note: the CTB itself is not emitted.

Errors

Returns Error::InvalidArgument if invoked on BodyLength::Indeterminate. If you want to serialize an old-style length, use serialize_old(..).

Exports a serialized version of the object to o. Read more

Computes the maximal length of the serialized representation. Read more

Serializes into the given buffer. Read more

Serializes the packet to a vector.

Exports into the given buffer. Read more

Exports to a vector. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.