Trait mail_core::context::ResourceLoaderComponent
source · pub trait ResourceLoaderComponent: Debug + Send + Sync + 'static {
fn load_resource(
&self,
source: &Source,
ctx: &impl Context
) -> SendBoxFuture<MaybeEncData, ResourceLoadingError>;
fn load_transfer_encoded_resource(
&self,
resource: &Resource,
ctx: &impl Context
) -> SendBoxFuture<EncData, ResourceLoadingError> { ... }
}Expand description
Trait needed to be implemented for providing the resource loading parts to aCompositeContext.
Required Methods§
sourcefn load_resource(
&self,
source: &Source,
ctx: &impl Context
) -> SendBoxFuture<MaybeEncData, ResourceLoadingError>
fn load_resource(
&self,
source: &Source,
ctx: &impl Context
) -> SendBoxFuture<MaybeEncData, ResourceLoadingError>
Calls to Context::load_resource will be forwarded to this method.
It is the same as Context::load_resource except that a reference
to the context containing this component is passed in. To prevent
infinite recursion the Context.load_resource method must not
be called. Additionally the Context.load_transfer_encoded_resource must not
be called if it uses Context.load_resource.
Provided Methods§
sourcefn load_transfer_encoded_resource(
&self,
resource: &Resource,
ctx: &impl Context
) -> SendBoxFuture<EncData, ResourceLoadingError>
fn load_transfer_encoded_resource(
&self,
resource: &Resource,
ctx: &impl Context
) -> SendBoxFuture<EncData, ResourceLoadingError>
Calls to Context::transfer_encode_resource will be forwarded to this method.
It is the same as Context::transfer_encode_resource except that a reference
to the context containing this component is passed in to make the offload
and load_resource methods of Context available.
To prevent infinite recursion the load_transfer_encoded_resource method
of the context must not be called.
Implementors§
impl<C> ResourceLoaderComponent for Cwhere
C: Context,
Allows using a part of an context as an component.