pub struct Mailcap { /* private fields */ }
Expand description
Meta representation of all available mailcap files and their combined lines.
Implementations§
Source§impl Mailcap
impl Mailcap
Sourcepub fn new() -> Result<Mailcap, MailcapError>
pub fn new() -> Result<Mailcap, MailcapError>
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
.
Sourcepub fn get(&self, key: &str) -> Option<&Entry>
pub fn get(&self, key: &str) -> Option<&Entry>
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§
impl StructuralPartialEq for Mailcap
Auto Trait Implementations§
impl Freeze for Mailcap
impl RefUnwindSafe for Mailcap
impl Send for Mailcap
impl Sync for Mailcap
impl Unpin for Mailcap
impl UnwindSafe for Mailcap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more