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

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

An iterator over components.

Using the ComponentAmalgamationIter::with_policy, it is possible to change the iterator to only return ComponentAmalgamations for valid components. In this case, ComponentAmalgamationIter::with_policy transforms the ComponentAmalgamationIter into a ValidComponentAmalgamationIter, which returns ValidComponentAmalgamations. ValidComponentAmalgamation offers additional filters.

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

A ComponentAmalgamationIter is returned by Cert::userids, Cert::user_attributes, and Cert::unknowns. (Cert::keys returns a KeyAmalgamationIter.)

Examples

Iterate over the User IDs in a certificate:

use openpgp::cert::prelude::*;

// Iterate over all User IDs.
for ua in cert.userids() {
    // ua is a `ComponentAmalgamation`, specifically, a `UserIDAmalgamation`.
}

Only return valid User IDs.

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

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

Implementations

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

pub fn with_policy<T>(
    self,
    policy: &'a dyn Policy,
    time: T
) -> ValidComponentAmalgamationIter<'a, C>

Notable traits for ValidComponentAmalgamationIter<'a, C>

impl<'a, C> Iterator for ValidComponentAmalgamationIter<'a, C> where
    C: Debug
type Item = ValidComponentAmalgamation<'a, C>;
where
    T: Into<Option<SystemTime>>, 
[src]

Changes the iterator to only return components that are valid according to the policy at the specified time.

If time is None, then the current time is used.

Refer to the ValidateAmalgamation trait for a definition of a valid component.

Examples

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

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

Trait Implementations

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

impl<'a, C> ExactSizeIterator for ComponentAmalgamationIter<'a, C>[src]

impl<'a, C> Iterator for ComponentAmalgamationIter<'a, C>[src]

type Item = ComponentAmalgamation<'a, C>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a, C> RefUnwindSafe for ComponentAmalgamationIter<'a, C> where
    C: RefUnwindSafe

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

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

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

impl<'a, C> UnwindSafe for ComponentAmalgamationIter<'a, C> where
    C: RefUnwindSafe

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.