Struct Entry

Source
pub struct Entry { /* private fields */ }
Expand description

Parsed mailcap line. Each mailcap entry consists of a number of fields, separated by semi-colons. The first two fields are required, and must occur in the specified order. The remaining fields are optional, and may appear in any order.

Implementations§

Source§

impl Entry

Source

pub fn mime(&self) -> &String

The mime_type, which indicates the type of data this mailcap entry describes how to handle. It is to be matched against the type/subtype specification in the “Content-Type” header field of an Internet mail message. If the subtype is specified as “*”, it is intended to match all subtypes of the named mime_type.

Source

pub fn viewer(&self, filename: &str) -> String

The second field, viewer, is a specification of how the message or body part can be viewed at the local site. Although the syntax of this field is fully specified, the semantics of program execution are necessarily somewhat operating system dependent. UNIX semantics are given in Appendix A of RFC 1524.

Source

pub fn compose(&self) -> &Option<String>

The compose field may be used to specify a program that can be used to compose a new body or body part in the given format. Its intended use is to support mail composing agents that support the composition of multiple types of mail using external composing agents. As with viewer, the semantics of program execution are operating system dependent, with UNIX semantics specified in Appendix A of RFC 1524. The result of the composing program may be data that is not yet suitable for mail transport – that is, a Content-Transfer-Encoding may need to be applied to the data.

Source

pub fn compose_typed(&self) -> &Option<String>

The compose_typed field is similar to the compose field, but is to be used when the composing program needs to specify the Content-type header field to be applied to the composed data. The compose field is simpler, and is preferred for use with existing (non-mail-oriented) programs for composing data in a given format. The compose_typed field is necessary when the Content-type information must include auxilliary parameters, and the composition program must then know enough about mail formats to produce output that includes the mail type information.

Source

pub fn edit(&self) -> &Option<String>

The edit field may be used to specify a program that can be used to edit a body or body part in the given format. In many cases, it may be identical in content to the compose field, and shares the operating-system dependent semantics for program execution.

Source

pub fn print(&self) -> &Option<String>

The print field may be used to specify a program that can be used to print a message or body part in the given format. As with viewer, the semantics of program execution are operating system dependent, with UNIX semantics specified in Appendix A of RFC 1524.

Source

pub fn test(&self) -> &Option<String>

The test field may be used to test some external condition (e.g., the machine architecture, or the window system in use) to determine whether or not the mailcap line applies. It specifies a program to be run to test some condition. The semantics of execution and of the value returned by the test program are operating system dependent, with UNIX semantics specified in Appendix A of RFC 1524. If the test fails, a subsequent mailcap entry should be sought. Multiple test fields are not permitted – since a test can call a program, it can already be arbitrarily complex.

Source

pub fn description(&self) -> &Option<String>

The description field simply provides a textual description, optionally quoted, that describes the type of data, to be used optionally by mail readers that wish to describe the data before offering to display it.

Source

pub fn name_template(&self) -> &Option<String>

The name_template field gives a file name format, in which %s will be replaced by a short unique string to give the name of the temporary file to be passed to the viewing command. This is only expected to be relevant in environments where filename extensions are meaningful, e.g., one coulld specify that a GIF file being passed to a gif viewer should have a name eding in “.gif” by using “nametemplate=%s.gif”.

Source

pub fn needs_terminal(&self) -> &bool

The needs_terminal field indicates that the viewer must be run on an interactive terminal. This is needed to inform window-oriented user agents that an interactive terminal is needed. (The decision is not left exclusively to viewer because in some circumstances it may not be possible for such programs to tell whether or not they are on interactive terminals). The needs_terminal command should be assumed to apply to the compose and edit commands, too, if they exist. Note that this is NOT a test – it is a requirement for the environment in which the program will be executed, and should typically cause the creation of a terminal window when not executed on either a real terminal or a terminal window.

Source

pub fn copious_output(&self) -> &bool

The copious_output field indicates that the output from viewer will be an extended stream of output, and is to be interpreted as advice to the UA (User Agent mail-reading program) that the output should be either paged or made scrollable. Note that it is probably a mistake if needs_terminal and copious_output are both specified.

Source

pub fn textual_new_lines(&self) -> &bool

The textual_new_lines field, if set to any non-zero value, indicates that this type of data is line-oriented and that, if encoded in base64, all newlines should be converted to canonical form (CRLF) before encoding, and will be in that form after decoding. In general, this field is needed only if there is line-oriented data of some type other than text/* or non-line-oriented data that is a subtype of text.

Trait Implementations§

Source§

impl Clone for Entry

Source§

fn clone(&self) -> Entry

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Entry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Entry

Source§

fn default() -> Entry

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

impl PartialEq for Entry

Source§

fn eq(&self, other: &Entry) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Entry

Auto Trait Implementations§

§

impl Freeze for Entry

§

impl RefUnwindSafe for Entry

§

impl Send for Entry

§

impl Sync for Entry

§

impl Unpin for Entry

§

impl UnwindSafe for Entry

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.