pub trait Builder: Default + 'static {
type Config: Configurator;
// Required method
fn build(self) -> Result<impl Access, Error>;
}Expand description
Builder is used to set up underlying services.
This trait allows the developer to define a builder struct that can:
- build a service via builder style API.
- configure in-memory options like
customized_credential_load.
Usually, users don’t need to use or import this trait directly, they can use Operator API instead.
For example:
use opendal_core::services::Memory;
use opendal_core::Operator;
async fn test() -> Result<()> {
// Create memory backend builder.
let builder = Memory::default();
// Build an `Operator` to start operating the storage.
let op: Operator = Operator::new(builder)?.finish();
Ok(())
}Required Associated Types§
Sourcetype Config: Configurator
type Config: Configurator
Associated configuration for this builder.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.