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 9580 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§
Source§impl BodyLength
impl BodyLength
Sourcepub fn serialize_old<W: Write + ?Sized>(&self, o: &mut W) -> Result<()>
pub fn serialize_old<W: Write + ?Sized>(&self, o: &mut W) -> Result<()>
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§
Source§impl Clone for BodyLength
impl Clone for BodyLength
Source§fn clone(&self) -> BodyLength
fn clone(&self) -> BodyLength
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BodyLength
impl Debug for BodyLength
Source§impl Marshal for BodyLength
impl Marshal for BodyLength
Source§fn serialize(&self, o: &mut dyn Write) -> Result<()>
fn serialize(&self, o: &mut dyn Write) -> Result<()>
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(..)
.