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

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

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

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

Blanket Implementations

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

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

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

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T> HeaderTryFrom<T> for T[src]

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.