Skip to main content

Builder

Trait Builder 

Source
pub trait Builder: Default + 'static {
    type Config: Configurator;

    // Required method
    fn build(self) -> Result<impl Service>;
}
Expand description

OpenDAL uses Builder to set up a service.

A Builder allows developers to:

  • Build a service through a builder-style API.
  • Configure in-memory options, such as customized_credential_load.

Users can usually use the Operator API instead of importing and using Builder directly. For example:

use opendal_core::services::Memory;
use opendal_core::Operator;
async fn test() -> Result<()> {
    // Create a memory backend builder.
    let builder = Memory::default();

    // Build an `Operator` to start operating the storage.
    let op: Operator = Operator::new(builder)?;

    Ok(())
}

Required Associated Types§

Source

type Config: Configurator

Associated configuration.

Required Methods§

Source

fn build(self) -> Result<impl Service>

Consume the builder to build a service.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Builder for ()

Dummy implementation of builder

Source§

type Config = ()

Source§

fn build(self) -> Result<impl Service>

Implementors§