[][src]Enum mail_core::Resource

pub enum Resource {
    Source(Source),
    Data(Data),
    EncData(EncData),
}

A enum specifying a "resource" for a mail.

A resource represents any kind of actual data. It can be anything from a html body of a mail over a embedded image to a attached spread sheet.

A resource can be specified in 3 ways:

  1. As a source specifying what to get and how to handle it.
  2. Data (and Metadata) representing a resource.
  3. Data (and Metadata) representing a transfer encoded resource.

Normally auto generated content will be provided as Data, embeddings and attachments will be provided as Source (potentially referring to a file on in a file system) and transfer encoded data can not be provided by the user.

When a mail is converted to a encodable mail any resource will be swapped with a version of it which is transfer encoded, so the only way a consumer of this library normally comes in contact with the third variant is by turning a encodable mail back into normal mail.

Variants

Provide a source which specify what data to use.

This also allows specifying a media type (if not stored with the data and sniffing is not wanted or to unreliable).

Additionally it allows to specify a "file name" which will force the given name to be used instead of inferring it from the IRI or meta data associated with the IRI in "some way" (like file name fild in a database from which the data will loaded).

Provide the data used for the mail bodies content.

This for example could be a png image.

Provides a already transfer encoded version of the Data variant.

This can not be created by a consumer of the library and will be created when turning a mail into a transfer encoded mail.

Methods

impl Resource
[src]

impl Resource
[src]

Creates a new text Resource with text/plain; charset=utf-8 media type.

The Context is used to generate a ContentId.

Return the content id, if there is any.

impl Resource
[src]

Create a Mail instance representing this Resource.

This is not a complete mail, i.e. it will not contain headers like From or To and in many cases the returned Mail instance will be wrapped into other mail instances adding alternative bodies, embedded resources and attachments.

Trait Implementations

impl Clone for Resource
[src]

Performs copy-assignment from source. Read more

impl Debug for Resource
[src]

Auto Trait Implementations

impl Send for Resource

impl Sync for Resource

Blanket Implementations

impl<T> From for T
[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

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

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

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, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

impl<F, T> HeaderTryInto for F where
    T: HeaderTryFrom<F>, 
[src]

impl<T> HeaderTryFrom for T
[src]

impl<T> Erased for T