Enum sequoia_openpgp::packet::header::BodyLength
source · 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§
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§fn clone_from(&mut self, source: &Self)
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(..)
.
source§impl MarshalInto for BodyLength
impl MarshalInto for BodyLength
source§fn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
source§fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
source§impl PartialEq for BodyLength
impl PartialEq for BodyLength
source§fn eq(&self, other: &BodyLength) -> bool
fn eq(&self, other: &BodyLength) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for BodyLength
impl StructuralPartialEq for BodyLength
Auto Trait Implementations§
impl Freeze for BodyLength
impl RefUnwindSafe for BodyLength
impl Send for BodyLength
impl Sync for BodyLength
impl Unpin for BodyLength
impl UnwindSafe for BodyLength
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
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)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)