pub struct Mailcap { /* private fields */ }
Expand description

Meta representation of all available mailcap files and their combined lines.

Implementations

Returns a combined mailcap from all available default files or a $MAILCAPS env. The default list (in ascending order of importance) includes:

  • /usr/local/etc/mailcap
  • /usr/etc/mailcap
  • /etc/mailcap
  • $HOME/.mailcap
Examples
let cap = Mailcap::new()?;
Errors

If there are no available mailcap files in the default locations or no $MAILCAPS env has been set, or if the files or empty or contain no valid mailcap lines, MailcapError will be returned. The implementation is loose: as long as one file exists with at least one valid mailcap line, the Result will be Ok.

Given a specific mime-type value, will lookup if there is an existing mailcap entry for that type.

Examples
let cap = Mailcap::new()?;
if let Some(i) = cap.get("text/html") {
    let command = i.viewer("/var/www/index.html");
    assert_eq!(command, "qutebrowser '/var/www/index.html'");
}

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.