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

pub struct MessageValidator { /* fields omitted */ }

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

Methods

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, depth: isize)[src]

Add the token token at depth depth to the token stream.

Note: top-level packets are at depth 0, their immediate children are a depth 1, etc.

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

pub fn push(&mut self, tag: Tag, depth: isize)[src]

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

Note: top-level packets are at depth 0.

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 Default for MessageValidator[src]

impl Debug for MessageValidator[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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

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

The type returned in the event of a conversion error.