[][src]Struct sequoia_openpgp::message::MessageValidator

pub struct MessageValidator { /* fields omitted */ }

Used to help validate a packet sequence is a valid OpenPGP message.

Implementations

impl MessageValidator[src]

pub fn new() -> Self[src]

Instantiates a new MessageValidator.

pub fn is_message(&self) -> bool[src]

Returns whether the packet sequence is a valid message.

Note: a MessageValidator will only return this after MessageValidator::finish has been called.

pub fn is_message_prefix(&self) -> bool[src]

Returns whether the packet sequence forms a valid message prefix.

Note: a MessageValidator will only return this before MessageValidator::finish has been called.

pub fn is_err(&self) -> bool[src]

Returns whether the packet sequence is definitely not a valid OpenPGP Message.

pub fn push_token(&mut self, token: Token, path: &[usize])[src]

Add the token token at position path to the token stream.

Note: top-level packets are at [ n ], their immediate children are at [ n, m ], etc.

This function pushes any required Token::Pop tokens based on changes in the path.

Note: the token must correspond to a packet; this function will panic if token is Token::Pop.

pub fn push(&mut self, tag: Tag, path: &[usize])[src]

Add a packet of type tag at position path to the token stream.

Note: top-level packets are at [ n ], their immediate children are at [ n, m ], etc.

Unlike push_token, this function does not automatically account for changes in the depth. If you use this function directly, you must push any required Token::Pop tokens.

pub fn finish(&mut self)[src]

Note that the entire message has been seen.

pub fn check(&self) -> MessageValidity[src]

Returns whether the token stream corresponds to a valid OpenPGP message.

This returns a tri-state: if the message is valid, it returns MessageValidity::Message, if the message is invalid, then it returns MessageValidity::Error. If the message could be valid, then it returns MessageValidity::MessagePrefix.

Note: if MessageValidator::finish() hasn't been called, then this function will only ever return either MessageValidity::MessagePrefix or MessageValidity::Error. Once MessageValidity::finish() has been called, then only MessageValidity::Message or MessageValidity::Bad will be called.

Trait Implementations

impl Debug for MessageValidator[src]

impl Default for MessageValidator[src]

Auto Trait Implementations

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<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>,