[][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.

Examples

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`.
}

Implementations

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

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

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
    .user_attributes()
    .with_policy(p, timestamp)
    .filter(|ca| {
        match ca.revocation_status() {
            RevocationStatus::Revoked(_) =>
                // It's definitely revoked, skip it.
                false,
            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.
                true,
            RevocationStatus::NotAsFarAsWeKnow =>
                // We have no evidence to suggest that the component
                // is revoked.
                true,
        }
    })
    .collect::<Vec<_>>();

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

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

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

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

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

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

impl<I> IntoIterator for I where
    I: Iterator
[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.