Module backend

Source
Expand description

§Backend

A backend is a set of features like adding folder, listing envelopes or sending message. This module exposes everything you need to create your own backend.

§Dynamic backend

A dynamic backend is composed of features defined at runtime. Calling an undefined feature leads to a runtime error. Such backend is useful when you do not know in advance which feature is enabled or disabled (for example, from a user configuration file).

The simplest way to build a dynamic backend is to use the BackendBuilder. It allows you to dynamically enable or disable features using the builder pattern. The build method consumes the builder to build the final backend. This module comes with two backend implementations:

  • Backend, a basic backend instance exposing features directly

  • [BackendPool], a backend where multiple contexts are built and put in a pool, which allow you to execute features in parallel

You can create your own instance by implementing the [AsyncTryIntoBackendFeatures] trait.

See a full example at ../../tests/dynamic_backend.rs.

§Static backend

A static backend is composed of features defined at compilation time. Such backend is useful when you know in advance which feature should be enabled or disabled. It mostly relies on traits. You will have to create your own backend instance as well as manually implement backend features.

See a full example at ../../tests/static_backend.rs.

Modules§

context
Backend context
feature
Backend feature
macros
mapper
Backend feature mapper

Structs§

Backend
The basic backend implementation.
BackendBuilder
The runtime backend builder.

Enums§

Error
The global Error enum of the module.

Type Aliases§

Result
The global Result alias of the module.