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> { ... }
fn from_iter(
iter: impl IntoIterator<Item = (String, String)>,
) -> Result<Self> { ... }
}Expand description
OpenDAL uses Configurator to configure a service.
This trait allows the developer to define a configuration struct that can:
- Deserialize from an iterator such as a hash map or vector.
- Convert into a service builder and then build a concrete service.
Users can usually use the Operator API instead of importing and using
Configurator directly. 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)?;
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>
fn from_uri(_uri: &OperatorUri) -> Result<Self>
Build configuration from a parsed URI with merged options.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".