[][src]Struct sequoia_openpgp::tpk::KeyIter

pub struct KeyIter<'a> { /* fields omitted */ }

An iterator over all Keys (both the primary key and any subkeys) in a TPK.

Returned by TPK::keys_all() and TPK::keys_valid().

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

By default, KeyIter will only return live, non-revoked keys. It is possible to control how KeyIter filters using, for instance, KeyIter::flags to only return keys with particular flags set.

Methods

impl<'a> KeyIter<'a>[src]

pub fn unfiltered(self) -> Self[src]

Clears all filters.

This causes the KeyIter to return all keys in the TPK.

pub fn empty() -> Self[src]

Returns an empty KeyIter.

pub fn key_flags(self, flags: KeyFlags) -> Self[src]

Returns keys that have the at least one of the flags specified in flags.

If you call this function (or one of certification_capable or signing_capable functions) multiple times, the union of the values is used. Thus, tpk.flags().certification_capable().signing_capable() will return keys that are certification capable or signing capable.

If you need more complex filtering, e.g., you want a key that is both certification and signing capable, then just use a normal Iterator::filter.

pub fn certification_capable(self) -> Self[src]

Returns keys that are certification capable.

See key_flags for caveats.

pub fn signing_capable(self) -> Self[src]

Returns keys that are signing capable.

See key_flags for caveats.

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

Only returns keys that are live as of now.

If now is none, then all keys are returned whether they are live or not.

A value of None disables this filter, which is set by default to only return live keys at the current time.

If you call this function (or alive) multiple times, only the last value is used.

pub fn alive(self) -> Self[src]

Only returns keys that are live right now.

If you call this function (or alive_at) multiple times, only the last value is used.

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

If not None, filters by whether a key is definitely revoked.

That is, whether it's revocation status is RevocationStatus::Revoked.

A value of None disables this filter, which is set by default to not return revoked keys.

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

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

If not None, filters by whether a key has a secret.

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

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

If not None, filters by whether a key has an unencrypted secret.

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

Trait Implementations

impl<'a> Debug for KeyIter<'a>[src]

impl<'a> Iterator for KeyIter<'a>[src]

type Item = (Option<&'a Signature>, RevocationStatus<'a>, &'a Key)

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for KeyIter<'a>

impl<'a> !Send for KeyIter<'a>

impl<'a> !Sync for KeyIter<'a>

impl<'a> Unpin for KeyIter<'a>

impl<'a> !UnwindSafe for KeyIter<'a>

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.