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

pub trait SerializeInto {
    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.

Required 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.

Loading content...

Provided methods

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 Ciphertext[src]

impl SerializeInto for PublicKey[src]

impl SerializeInto for SecretKeyMaterial[src]

impl SerializeInto for sequoia_openpgp::crypto::mpis::Signature[src]

impl SerializeInto for S2K[src]

impl SerializeInto for Sexp[src]

impl SerializeInto for Fingerprint[src]

impl SerializeInto for KeyID[src]

impl SerializeInto for Packet[src]

impl SerializeInto for AED[src]

impl SerializeInto for OnePassSig[src]

impl SerializeInto for PKESK[src]

impl SerializeInto for SEIP[src]

impl SerializeInto for SKESK[src]

impl SerializeInto for sequoia_openpgp::packet::Signature[src]

impl SerializeInto for CTB[src]

impl SerializeInto for BodyLength[src]

impl SerializeInto for Image[src]

impl SerializeInto for sequoia_openpgp::packet::user_attribute::Subpacket[src]

impl SerializeInto for Cert[src]

impl SerializeInto for MPI[src]

impl SerializeInto for ProtectedMPI[src]

impl SerializeInto for String_[src]

impl SerializeInto for AED1[src]

impl SerializeInto for CTBNew[src]

impl SerializeInto for CTBOld[src]

impl SerializeInto for OnePassSig3[src]

impl SerializeInto for PKESK3[src]

impl SerializeInto for Signature4[src]

impl SerializeInto for SKESK4[src]

impl SerializeInto for SKESK5[src]

impl SerializeInto for CompressedData[src]

fn serialized_len(&self) -> usize[src]

Computes the maximal length of the serialized representation.

The size of the serialized compressed data packet is tricky to predict. First, it depends on the data being compressed. Second, we emit partial body encoded data.

This function tries overestimates the length. However, it may happen that serialize_into() fails.

Errors

If serialization would fail, this function returns 0.

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

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

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

impl SerializeInto for Literal[src]

impl SerializeInto for MDC[src]

impl SerializeInto for Marker[src]

impl SerializeInto for Trust[src]

impl SerializeInto for Unknown[src]

impl SerializeInto for UserID[src]

impl SerializeInto for UserAttribute[src]

impl SerializeInto for Message[src]

impl SerializeInto for PacketPile[src]

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

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

impl<'a> SerializeInto for sequoia_openpgp::packet::signature::subpacket::Subpacket<'a>[src]

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

impl<P, R> SerializeInto for Key4<P, R> where
    P: KeyParts,
    R: KeyRole
[src]

impl<P: KeyParts, R: KeyRole> SerializeInto for Key<P, R>[src]

Loading content...