[−][src]Struct mail_core::context::CompositeContext
The CompositeContext
is the simplest way to get an Context
implementation.
Any custom Context
implementations should be realized through the CompositeContext
if possible.
This type consists of 3 components it forward all method calls from Context
to.
This allows the library to have a single Context
type but match and mix the
parts about resource loading, offloading and id generation in whichever way
it fits best.
The composite context will store the components inside of an Arc
so that
it can be easily shared through an application, it also means non of the
components have to implement Clone
.
Methods
impl<R, O, M> CompositeContext<R, O, M> where
R: ResourceLoaderComponent,
O: OffloaderComponent,
M: MailIdGenComponent,
[src]
R: ResourceLoaderComponent,
O: OffloaderComponent,
M: MailIdGenComponent,
pub fn new(resource_loader: R, offloader: O, message_id_gen: M) -> Self
[src]
Create a new context from the given components.
pub fn resource_loader(&self) -> &R
[src]
Returns a reference to the resource loader component.
pub fn offloader(&self) -> &O
[src]
Returns a reference to the offloader component.
pub fn id_gen(&self) -> &M
[src]
Returns a reference to the id generation component.
Trait Implementations
impl<R, O, M> Clone for CompositeContext<R, O, M> where
R: ResourceLoaderComponent,
O: OffloaderComponent,
M: MailIdGenComponent,
[src]
R: ResourceLoaderComponent,
O: OffloaderComponent,
M: MailIdGenComponent,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<R, O, M> Context for CompositeContext<R, O, M> where
R: ResourceLoaderComponent,
O: OffloaderComponent,
M: MailIdGenComponent,
[src]
R: ResourceLoaderComponent,
O: OffloaderComponent,
M: MailIdGenComponent,
fn load_resource(
&self,
source: &Source
) -> SendBoxFuture<MaybeEncData, ResourceLoadingError>
[src]
&self,
source: &Source
) -> SendBoxFuture<MaybeEncData, ResourceLoadingError>
fn load_transfer_encoded_resource(
&self,
resource: &Resource
) -> SendBoxFuture<EncData, ResourceLoadingError>
[src]
&self,
resource: &Resource
) -> SendBoxFuture<EncData, ResourceLoadingError>
fn offload<F>(&self, fut: F) -> SendBoxFuture<F::Item, F::Error> where
F: Future + Send + 'static,
F::Item: Send + 'static,
F::Error: Send + 'static,
[src]
F: Future + Send + 'static,
F::Item: Send + 'static,
F::Error: Send + 'static,
fn generate_content_id(&self) -> ContentId
[src]
fn generate_message_id(&self) -> MessageId
[src]
fn offload_fn<FN, I>(&self, func: FN) -> SendBoxFuture<I::Item, I::Error> where
FN: FnOnce() -> I + Send + 'static,
I: IntoFuture + 'static,
I::Future: Send + 'static,
I::Item: Send + 'static,
I::Error: Send + 'static,
[src]
FN: FnOnce() -> I + Send + 'static,
I: IntoFuture + 'static,
I::Future: Send + 'static,
I::Item: Send + 'static,
I::Error: Send + 'static,
impl<R: Debug + ResourceLoaderComponent, O: Debug + OffloaderComponent, M: Debug + MailIdGenComponent> Debug for CompositeContext<R, O, M>
[src]
Auto Trait Implementations
impl<R, O, M> RefUnwindSafe for CompositeContext<R, O, M> where
M: RefUnwindSafe,
O: RefUnwindSafe,
R: RefUnwindSafe,
M: RefUnwindSafe,
O: RefUnwindSafe,
R: RefUnwindSafe,
impl<R, O, M> Send for CompositeContext<R, O, M>
impl<R, O, M> Sync for CompositeContext<R, O, M>
impl<R, O, M> Unpin for CompositeContext<R, O, M>
impl<R, O, M> UnwindSafe for CompositeContext<R, O, M> where
M: RefUnwindSafe,
O: RefUnwindSafe,
R: RefUnwindSafe,
M: RefUnwindSafe,
O: RefUnwindSafe,
R: RefUnwindSafe,
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> Erased for T
[src]
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<C> MailIdGenComponent for C where
C: Context,
[src]
C: Context,
fn generate_message_id(&Self) -> MessageId
[src]
fn generate_content_id(&Self) -> MessageId
[src]
impl<C> OffloaderComponent for C where
C: Context,
[src]
C: Context,
fn offload<F>(
&Self,
F
) -> Box<dyn Future<Error = <F as Future>::Error, Item = <F as Future>::Item> + 'static + Send> where
F: Future + Send + 'static,
<F as Future>::Item: Send,
<F as Future>::Item: 'static,
<F as Future>::Error: Send,
<F as Future>::Error: 'static,
[src]
&Self,
F
) -> Box<dyn Future<Error = <F as Future>::Error, Item = <F as Future>::Item> + 'static + Send> where
F: Future + Send + 'static,
<F as Future>::Item: Send,
<F as Future>::Item: 'static,
<F as Future>::Error: Send,
<F as Future>::Error: 'static,
impl<C> ResourceLoaderComponent for C where
C: Context,
[src]
C: Context,
fn load_resource(
&Self,
&Source,
&impl Context
) -> Box<dyn Future<Error = ResourceLoadingError, Item = MaybeEncData> + 'static + Send>
[src]
&Self,
&Source,
&impl Context
) -> Box<dyn Future<Error = ResourceLoadingError, Item = MaybeEncData> + 'static + Send>
fn load_transfer_encoded_resource(
&Self,
&Resource,
&impl Context
) -> Box<dyn Future<Error = ResourceLoadingError, Item = EncData> + 'static + Send>
[src]
&Self,
&Resource,
&impl Context
) -> Box<dyn Future<Error = ResourceLoadingError, Item = EncData> + 'static + Send>
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>,