[−][src]Struct mail_core::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.
Methods
impl Data
[src]
pub fn new(buffer: impl Into<Arc<[u8]>>, meta: impl Into<Arc<Metadata>>) -> Self
[src]
Create a new data instance.
pub fn plain_text(text: impl Into<String>, cid: ContentId) -> 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) -> &ContentId
[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]
fn clone(&self) -> Data
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Data
[src]
impl Serialize for Data
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Data
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<F, T> HeaderTryInto for F where
T: HeaderTryFrom<F>,
[src]
T: HeaderTryFrom<F>,