Enum sequoia_openpgp::packet::header::BodyLength
source · [−]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
sourceimpl 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
sourceimpl Clone for BodyLength
impl Clone for BodyLength
sourcefn clone(&self) -> BodyLength
fn clone(&self) -> BodyLength
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for BodyLength
impl Debug for BodyLength
sourceimpl Marshal for BodyLength
impl Marshal for BodyLength
sourcefn 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(..)
.
sourceimpl MarshalInto for BodyLength
impl MarshalInto for BodyLength
sourcefn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
Computes the maximal length of the serialized representation. Read more
sourcefn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
Serializes into the given buffer. Read more
sourceimpl PartialEq<BodyLength> for BodyLength
impl PartialEq<BodyLength> for BodyLength
sourcefn eq(&self, other: &BodyLength) -> bool
fn eq(&self, other: &BodyLength) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &BodyLength) -> bool
fn ne(&self, other: &BodyLength) -> bool
This method tests for !=
.
impl Copy for BodyLength
impl StructuralPartialEq for BodyLength
Auto Trait Implementations
impl RefUnwindSafe for BodyLength
impl Send for BodyLength
impl Sync for BodyLength
impl Unpin for BodyLength
impl UnwindSafe for BodyLength
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more