[−][src]Struct mail::Data
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]
fn deserialize<__D>(
__deserializer: __D
) -> Result<Data, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Data, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl Serialize for Data
[src]
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T> HeaderTryFrom<T> for T
[src]
fn try_from(val: T) -> Result<T, ComponentCreationError>
[src]
impl<F, T> HeaderTryInto<T> for F where
T: HeaderTryFrom<F>,
[src]
T: HeaderTryFrom<F>,
fn try_into(self) -> Result<T, ComponentCreationError>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,