[][src]Struct sequoia_openpgp::cert::bundle::ValidComponentBundleIter

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

An iterator over all valid Components of a given type in a certificate.

A component is valid at time t if it was not created after t and it has a live self-signature at time t.

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

Implementations

impl<'a, C> ValidComponentBundleIter<'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.

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

Note: This 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:

extern crate 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.revoked() {
            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::revoked. However, this filter implements a typical policy, and does not preclude using filter to realize alternative policies.

Trait Implementations

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

impl<'a, C> Iterator for ValidComponentBundleIter<'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 ValidComponentBundleIter<'a, C>

impl<'a, C> !Send for ValidComponentBundleIter<'a, C>

impl<'a, C> !Sync for ValidComponentBundleIter<'a, C>

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

impl<'a, C> !UnwindSafe for ValidComponentBundleIter<'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<I> IteratorRandom for I where
    I: Iterator
[src]

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.

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