Trait nuts_backend::Create

source ·
pub trait Create<B: Backend>: HeaderSet<B> {
    // Required methods
    fn settings(&self) -> B::Settings;
    fn build(self) -> Result<B, B::Err>;
}
Expand description

Trait to configure the creation of a Backend.

Should contain options used to create a specific backend. When a container is created, this trait is used to create the related backend.

The Create::settings() method returns an instance of the settings of this backend instance. The settings contains runtime configuration used by the backend. The container stores the settings (possibly encrypted) in the header of the container and should contain all settings/information needed by the backend. It is loaded again from the header when the container is opened.

Any type that implements this Create trait must also implement the HeaderSet trait because the header of the container is created here.

Finally, the container calls Create::build() to create an instance of the Backend. The resulting backend instance should be able to handle all operations on it. The Create::build() method should validate all its settings before returning the backend instance!

Required Methods§

source

fn settings(&self) -> B::Settings

Returns the settings of this backend instance.

The settings contains runtime configuration used by the backend. The container stores the settings (possibly encrypted) in the header of the container and should contain all settings/information needed by the backend. It is loaded again from the header when the container is opened.

source

fn build(self) -> Result<B, B::Err>

Create an instance of the Backend.

The container calls Create::build() to create an instance of the Backend. The resulting backend instance should be able to handle all operations on it. The Create::build() method should validate all its settings before returning the backend instance!

Implementors§