Struct sequoia_openpgp::cert::raw::RawPacket

source ·
pub struct RawPacket<'a> { /* private fields */ }
Expand description

A mostly unparsed Packet.

This is returned by RawCert::packets.

The data includes the OpenPGP framing (i.e., the CTB, and length information). RawPacket::body returns just the bytes corresponding to the packet’s body, i.e., without the OpenPGP framing.

You can convert it to a Packet using TryFrom.

§Examples

use sequoia_openpgp as openpgp;
use openpgp::packet::Packet;
use openpgp::packet::Tag;
for p in rawcert.packets() {
    if p.tag() == Tag::SecretSubkey {
        if let Ok(packet) = Packet::try_from(p) {
            // Do something with the packet.
        }
    }
}

Implementations§

source§

impl<'a> RawPacket<'a>

source

pub fn tag(&self) -> Tag

Returns the packet’s tag.

source

pub fn as_bytes(&self) -> &[u8]

Returns the packet’s bytes.

source

pub fn body(&self) -> &[u8]

Return the packet’s body without the OpenPGP framing.

Trait Implementations§

source§

impl<'a> Clone for RawPacket<'a>

source§

fn clone(&self) -> RawPacket<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RawPacket<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Marshal for RawPacket<'a>

source§

fn serialize(&self, o: &mut dyn Write) -> Result<()>

Writes a serialized version of the object to o.
source§

fn export(&self, o: &mut dyn Write) -> Result<()>

Exports a serialized version of the object to o. Read more
source§

impl<'a> PartialEq for RawPacket<'a>

source§

fn eq(&self, other: &RawPacket<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> TryFrom<RawPacket<'a>> for Packet

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(p: RawPacket<'a>) -> Result<Self>

Performs the conversion.
source§

impl<'a> Eq for RawPacket<'a>

source§

impl<'a> StructuralPartialEq for RawPacket<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for RawPacket<'a>

§

impl<'a> RefUnwindSafe for RawPacket<'a>

§

impl<'a> Send for RawPacket<'a>

§

impl<'a> Sync for RawPacket<'a>

§

impl<'a> Unpin for RawPacket<'a>

§

impl<'a> UnwindSafe for RawPacket<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.