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

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.

Implementations

Create a new context from the given components.

Returns a reference to the resource loader component.

Returns a reference to the offloader component.

Returns a reference to the id generation component.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Loads and transfer encodes a Data instance. Read more
Loads and Transfer encodes a Resource instance. Read more
offloads the execution of the future fut to somewhere else e.g. a cpu pool
generate a unique content id Read more
generate a unique content id Read more
offloads the execution of the function func to somewhere else e.g. a cpu pool
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Calls to Context::generate_message_id will be forwarded to this method.
Calls to Context::generate_content_id will be forwarded to this method.
Calls to Context::offload and Context::offload_fn will be forwarded to this method.
Calls to Context::load_resource will be forwarded to this method. Read more
Calls to Context::transfer_encode_resource will be forwarded to this method. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.