[][src]Enum sequoia_openpgp::KeyHandle

pub enum KeyHandle {
    Fingerprint(Fingerprint),
    KeyID(KeyID),
}

Identifies certificates and keys.

A KeyHandle is either a Fingerprint or a KeyID.

Variants

Fingerprint(Fingerprint)

A Fingerprint.

KeyID(KeyID)

A KeyID.

Methods

impl KeyHandle[src]

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

Returns a reference to the raw identifier.

pub fn aliases<H>(&self, other: H) -> bool where
    H: Borrow<KeyHandle>, 
[src]

Returns whether self and other could be aliases of each other.

KeyHandle's PartialEq implementation cannot assert that a Fingerprint and a KeyID are equal, because distinct fingerprints may have the same KeyID, and PartialEq must be transitive, i.e.,

a == b and b == c implies a == c.

That is, if fpr1 and fpr2 are distinct fingerprints with the same key ID then:

fpr1 == keyid and fpr2 == keyid, but fpr1 != fpr2.

In these cases (and only these cases) KeyHandle's PartialOrd implementation returns None to correctly indicate that a comparison is not possible.

This definition of equality makes searching for a given KeyHandle using PartialEq awkward. This function fills that gap. It answers the question: given two KeyHandles, could they be aliases? That is, it implements the desired, non-transitive equality relation:

// fpr1 and fpr2 are different fingerprints with the same KeyID.
assert!(! fpr1.eq(&fpr2));
assert!(fpr1.aliases(&keyid));
assert!(fpr2.aliases(&keyid));
assert!(! fpr1.aliases(&fpr2));

Trait Implementations

impl From<KeyID> for KeyHandle[src]

impl<'_> From<&'_ KeyID> for KeyHandle[src]

impl From<KeyHandle> for KeyID[src]

impl<'_> From<&'_ KeyHandle> for KeyID[src]

impl From<Fingerprint> for KeyHandle[src]

impl<'_> From<&'_ Fingerprint> for KeyHandle[src]

impl PartialOrd<KeyHandle> for KeyHandle[src]

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialEq<KeyHandle> for KeyHandle[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Clone for KeyHandle[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Display for KeyHandle[src]

impl Hash for KeyHandle[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for KeyHandle[src]

impl TryFrom<KeyHandle> for Fingerprint[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ KeyHandle> for Fingerprint[src]

type Error = Error

The type returned in the event of a conversion error.

impl LowerHex for KeyHandle[src]

impl UpperHex for KeyHandle[src]

Auto Trait Implementations

impl Send for KeyHandle

impl Sync for KeyHandle

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip for T where
    V: MultiLane<T>,