Trait sequoia_openpgp::serialize::Marshal [−][src]
pub trait Marshal: Sealed { fn serialize(&self, o: &mut dyn Write) -> Result<()>; fn export(&self, o: &mut dyn Write) -> Result<()> { ... } }
Expand description
Serializes OpenPGP data structures.
This trait provides the same interface as Serialize
, but is
implemented for all data structures that can be serialized.
In general, you should prefer the Serialize
trait, as it is only
implemented for data structures that are normally exported. See
the documentation for Serialize
for more details.
Sealed trait
This trait is sealed and cannot be implemented for types outside this crate.
Therefore it can be extended in a non-breaking way.
If you want to implement the trait inside the crate
you also need to implement the seal::Sealed
marker trait.
Required methods
Provided methods
Exports a serialized version of the object to o
.
This is similar to serialize(..)
, with these exceptions:
Implementors
Writes a serialized version of the specified Packet
to o
.
This function works recursively: if the packet contains any packets, they are also serialized.
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(..)
.