[][src]Struct mail_core::context::CompositeContext

pub struct CompositeContext<R: ResourceLoaderComponent, O: OffloaderComponent, M: MailIdGenComponent> { /* fields omitted */ }

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]

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> Context for CompositeContext<R, O, M> where
    R: ResourceLoaderComponent,
    O: OffloaderComponent,
    M: MailIdGenComponent
[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]

offloads the execution of the function func to somewhere else e.g. a cpu pool

impl<R, O, M> Clone for CompositeContext<R, O, M> where
    R: ResourceLoaderComponent,
    O: OffloaderComponent,
    M: MailIdGenComponent
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<R: Debug + ResourceLoaderComponent, O: Debug + OffloaderComponent, M: Debug + MailIdGenComponent> Debug for CompositeContext<R, O, M>[src]

Auto Trait Implementations

impl<R, O, M> Send for CompositeContext<R, O, M>

impl<R, O, M> Sync for CompositeContext<R, O, M>

Blanket Implementations

impl<C> ResourceLoaderComponent for C where
    C: Context
[src]

impl<C> OffloaderComponent for C where
    C: Context
[src]

impl<C> MailIdGenComponent for C where
    C: Context
[src]

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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

impl<T> HeaderTryFrom for T[src]

impl<T> Erased for T