pub trait Builder: Default + 'static {
type Config: Configurator;
// Required method
fn build(self) -> Result<impl Access>;
}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
http_clientorcustomized_credential_load.
Usually, users don’t need to use or import this trait directly, they can use Operator API instead.
For example:
use opendal::services::Fs;
use opendal::Operator;
async fn test() -> Result<()> {
// Create fs backend builder.
let mut builder = Fs::default().root("/tmp");
// 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".