[−][src]Enum mail::Resource
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:
- As a source specifying what to get and how to handle it.
- Data (and Metadata) representing a resource.
- 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
Source(Source)
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).
Data(Data)
Provide the data used for the mail bodies content.
This for example could be a png image.
EncData(EncData)
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]
pub fn load_container<CO, impl Context>(
container: CO,
ctx: &impl Context
) -> ResourceContainerLoadingFuture<CO> where
CO: ContainedResourcesAccess,
impl Context: Context,
[src]
container: CO,
ctx: &impl Context
) -> ResourceContainerLoadingFuture<CO> where
CO: ContainedResourcesAccess,
impl Context: Context,
impl Resource
[src]
pub fn plain_text<impl Into, impl Context>(
content: impl Into,
ctx: &impl Context
) -> Resource where
impl Context: Context,
impl Into: Into<String>,
[src]
content: impl Into
ctx: &impl Context
) -> Resource where
impl Context: Context,
impl Into
Creates a new text Resource
with text/plain; charset=utf-8
media type.
The Context
is used to generate a ContentId
.
pub fn content_id(&self) -> Option<&MessageId>
[src]
Return the content id, if there is any.
impl Resource
[src]
pub fn create_mail(self) -> Mail
[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.
pub fn create_mail_with_disposition(
self,
disposition_kind: DispositionKind
) -> Mail
[src]
self,
disposition_kind: DispositionKind
Trait Implementations
impl Serialize for Resource
[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,
impl<'de> Deserialize<'de> for Resource
[src]
fn deserialize<__D>(
__deserializer: __D
) -> Result<Resource, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Resource, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl Debug for Resource
[src]
impl Clone for Resource
[src]
fn clone(&self) -> Resource
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PathRebaseable for Resource
[src]
fn rebase_to_include_base_dir<impl AsRef>(
&mut self,
base_dir: impl AsRef
) -> Result<(), UnsupportedPathError> where
impl AsRef: AsRef<Path>,
[src]
&mut self,
base_dir: impl AsRef
) -> Result<(), UnsupportedPathError> where
impl AsRef
fn rebase_to_exclude_base_dir<impl AsRef>(
&mut self,
base_dir: impl AsRef
) -> Result<(), UnsupportedPathError> where
impl AsRef: AsRef<Path>,
[src]
&mut self,
base_dir: impl AsRef
) -> Result<(), UnsupportedPathError> where
impl AsRef
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 = !
try_from
)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, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)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> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
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>,