[][src]Trait sequoia_openpgp::serialize::SerializeInto

pub trait SerializeInto: MarshalInto {
    fn serialized_len(&self) -> usize { ... }
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize> { ... }
fn to_vec(&self) -> Result<Vec<u8>> { ... }
fn export_into(&self, buf: &mut [u8]) -> Result<usize> { ... }
fn export_to_vec(&self) -> Result<Vec<u8>> { ... } }

Serializes OpenPGP data structures into pre-allocated buffers.

This trait provides the same interface as MarshalInto, but is only implemented for data structures that can be serialized.

In general, you should prefer this trait to MarshalInto, as it is only implemented for data structures that are normally exported. See the documentation for Serialize for more details.

Provided methods

fn serialized_len(&self) -> usize

Computes the maximal length of the serialized representation.

Errors

If serialization would fail, this function underestimates the length.

fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>

Serializes into the given buffer.

Returns the length of the serialized representation.

Errors

If the length of the given slice is smaller than the maximal length computed by serialized_len(), this function returns Error::InvalidArgument.

fn to_vec(&self) -> Result<Vec<u8>>

Serializes the packet to a vector.

fn export_into(&self, buf: &mut [u8]) -> Result<usize>

Exports into the given buffer.

This is similar to serialize_into(..), with these exceptions:

  • It is an error to export a Signature if it is marked as non-exportable.
  • When exporting a Cert, non-exportable signatures are not exported, and any component bound merely by non-exportable signatures is not exported.

Returns the length of the serialized representation.

Errors

If the length of the given slice is smaller than the maximal length computed by serialized_len(), this function returns Error::InvalidArgument.

fn export_to_vec(&self) -> Result<Vec<u8>>

Exports to a vector.

This is similar to to_vec(), with these exceptions:

  • It is an error to export a Signature if it is marked as non-exportable.
  • When exporting a Cert, non-exportable signatures are not exported, and any component bound merely by non-exportable signatures is not exported.
Loading content...

Implementors

impl SerializeInto for Fingerprint[src]

impl SerializeInto for KeyID[src]

impl SerializeInto for Packet[src]

impl SerializeInto for Cert[src]

impl SerializeInto for Message[src]

impl SerializeInto for PacketPile[src]

impl<'a> SerializeInto for TSK<'a>[src]

Loading content...