[][src]Struct mail::Data

pub struct Data { /* fields omitted */ }

A type containing some data and metadata for it.

This often, but not always, corresponds to data which could potentially have been a file in a file system. For example a image or a text document.

This type is mainly used when having auto generated content as content provided through a file should be loaded from a source and as such will be directly loaded and transfer encoded.

Clone

Data is made to be cheap to clone and share. For this it uses Arc internally.

Implementations

impl Data[src]

pub fn new(buffer: impl Into<Arc<[u8]>>, meta: impl Into<Arc<Metadata>>) -> Data[src]

Create a new data instance.

pub fn plain_text(text: impl Into<String>, cid: MessageId) -> Data[src]

pub fn buffer(&self) -> &Arc<[u8]>[src]

Access the raw data buffer of this instance.

pub fn metadata(&self) -> &Arc<Metadata>[src]

Access the metadata.

pub fn file_meta(&self) -> &FileMeta[src]

Access the file meta metadata.Fn

pub fn media_type(&self) -> &MediaType[src]

Access the content type.

pub fn content_id(&self) -> &MessageId[src]

Access the content id.

pub fn transfer_encode(&self, encoding_hint: TransferEncodingHint) -> EncData[src]

Transfer encode the given data.

This function will be called by the context implementation when loading and/or transfer encoding data. The context implementation might also not call it if it has a cached version of the transfer encoded data.

This functions expect a boundary pool and will remove all boundaries which do appear in the encoded representation of the data.

Trait Implementations

impl Clone for Data[src]

impl Debug for Data[src]

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

impl Serialize for Data[src]

Auto Trait Implementations

impl RefUnwindSafe for Data

impl Send for Data

impl Sync for Data

impl Unpin for Data

impl UnwindSafe for Data

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

impl<T> Erased for T

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.