[][src]Struct sequoia_openpgp::cert::amalgamation::ValidComponentAmalgamationIter

pub struct ValidComponentAmalgamationIter<'a, C> { /* fields omitted */ }

An iterator over valid components.

A ValidComponentAmalgamationIter is a ComponentAmalgamationIter with a policy and a reference time.

This allows it to filter the returned components based on information available in the components' binding signatures. For instance, ValidComponentAmalgamationIter::revoked filters the returned components by whether or not they are revoked.

ValidComponentAmalgamationIter follows the builder pattern. There is no need to explicitly finalize it: it already implements the Iterator trait.

A ValidComponentAmalgamationIter is returned by ComponentAmalgamationIter::with_policy.


use openpgp::cert::prelude::*;
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();

// Iterate over all valid User Attributes.
for ua in cert.userids().with_policy(p, None) {
    // ua is a `ValidComponentAmalgamation`, specifically, a
    // `ValidUserIDAmalgamation`.


impl<'a, C> ValidComponentAmalgamationIter<'a, C>[src]

pub fn revoked<T>(self, revoked: T) -> Self where
    T: Into<Option<bool>>, 

Filters by whether a component is definitely revoked.

A value of None disables this filter.

If you call this function multiple times on the same iterator, only the last value is used.

This filter only checks if the component is not revoked; it does not check whether the certificate not revoked.

This filter checks whether a component's revocation status is RevocationStatus::Revoked or not. The latter (i.e., revoked(false)) is equivalent to:

use sequoia_openpgp as openpgp;
use openpgp::cert::prelude::*;
use openpgp::types::RevocationStatus;
use sequoia_openpgp::policy::StandardPolicy;

let p = &StandardPolicy::new();

let non_revoked_uas = cert
    .with_policy(p, timestamp)
    .filter(|ca| {
        match ca.revocation_status() {
            RevocationStatus::Revoked(_) =>
                // It's definitely revoked, skip it.
            RevocationStatus::CouldBe(_) =>
                // There is a designated revoker that we
                // should check, but don't (or can't).  To
                // avoid a denial of service arising from fake
                // revocations, we assume that the component has not
                // been revoked and return it.
            RevocationStatus::NotAsFarAsWeKnow =>
                // We have no evidence to suggest that the component
                // is revoked.

As the example shows, this filter is significantly less flexible than using ValidComponentAmalgamation::revocation_status. However, this filter implements a typical policy, and does not preclude using filter to realize alternative policies.

Trait Implementations

impl<'a, C> Debug for ValidComponentAmalgamationIter<'a, C>[src]

impl<'a, C> Iterator for ValidComponentAmalgamationIter<'a, C> where
    C: Debug

type Item = ValidComponentAmalgamation<'a, C>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a, C> !RefUnwindSafe for ValidComponentAmalgamationIter<'a, C>

impl<'a, C> Send for ValidComponentAmalgamationIter<'a, C> where
    C: Sync

impl<'a, C> Sync for ValidComponentAmalgamationIter<'a, C> where
    C: Sync

impl<'a, C> Unpin for ValidComponentAmalgamationIter<'a, C>

impl<'a, C> !UnwindSafe for ValidComponentAmalgamationIter<'a, C>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<I> IntoIterator for I where
    I: Iterator

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Error = Infallible

The type returned in the event of a conversion error.

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.