[][src]Struct trapmail::Mail

pub struct Mail {
    pub cli_options: CliOptions,
    pub pid: Pid,
    pub ppid: Pid,
    pub body: MailBody,
    pub timestamp_us: u128,
}

A "sent" mail.

Fields

cli_options: CliOptions

The command line arguments passed to trapmail at the time of call.

pid: Pid

The ID of the trapmail process that stored this email.

ppid: Pid

The ID of the parent process that called trapmail.

body: MailBody

The trapmail call's raw body.

timestamp_us: u128

A microsecond-resolution UNIX timestamp of when the mail arrived.

Methods

impl Mail[src]

pub fn new(cli_options: CliOptions, raw_body: Vec<u8>) -> Self[src]

Create a new Mail using the current time and process information.

This function will sleep for a microsecond to avoid any conflicts in naming (see file_name).

Panics

Will panic if the system returns a time before the UNIX epoch.

pub fn file_name(&self) -> PathBuf[src]

Create a (pathless) file_name depending on the Mail contents.

pub fn load<P: AsRef<Path>>(source: P) -> Result<Self, Error>[src]

Load a Mail from a file.

Trait Implementations

impl Debug for Mail[src]

impl<'de> Deserialize<'de> for Mail[src]

impl Display for Mail[src]

impl Serialize for Mail[src]

Auto Trait Implementations

impl RefUnwindSafe for Mail

impl Send for Mail

impl Sync for Mail

impl Unpin for Mail

impl UnwindSafe for Mail

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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

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

impl<T> ToString for T where
    T: Display + ?Sized
[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.