pub trait Configurator:
Serialize
+ DeserializeOwned
+ Debug
+ 'static {
type Builder: Builder;
// Required method
fn into_builder(self) -> Self::Builder;
// Provided methods
fn from_uri(_uri: &OperatorUri) -> Result<Self, Error> { ... }
fn from_iter(
iter: impl IntoIterator<Item = (String, String)>,
) -> Result<Self, Error> { ... }
}Expand description
Configurator is used to configure the underlying service.
This trait allows the developer to define a configuration struct that can:
- deserialize from an iterator like hashmap or vector.
- convert into a service builder and finally build the underlying services.
Usually, users don’t need to use or import this trait directly, they can use Operator API instead.
For example:
use std::collections::HashMap;
use opendal_core::services::MemoryConfig;
use opendal_core::Operator;
async fn test() -> Result<()> {
let mut cfg = MemoryConfig::default();
cfg.root = Some("/".to_string());
// Build an `Operator` to start operating the storage.
let op: Operator = Operator::from_config(cfg)?.finish();
Ok(())
}Required Associated Types§
Required Methods§
Sourcefn into_builder(self) -> Self::Builder
fn into_builder(self) -> Self::Builder
Convert this configuration into a service builder.
Provided Methods§
Sourcefn from_uri(_uri: &OperatorUri) -> Result<Self, Error>
fn from_uri(_uri: &OperatorUri) -> Result<Self, Error>
Build configuration from a parsed URI plus merged options.
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.