Trait opendal::Configurator

source ·
pub trait Configurator: Serialize + DeserializeOwned + Debug + 'static {
    type Builder: Builder;

    // Required method
    fn into_builder(self) -> Self::Builder;

    // Provided method
    fn from_iter(
        iter: impl IntoIterator<Item = (String, String)>,
    ) -> Result<Self> { ... }
}
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::services::MemoryConfig;
use opendal::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(())
}

Some service builder might contain in memory options like http_client . Users can call into_builder to convert the configuration into a builder instead.

use std::collections::HashMap;

use opendal::raw::HttpClient;
use opendal::services::S3Config;
use opendal::Configurator;
use opendal::Operator;

async fn test() -> Result<()> {
    let mut cfg = S3Config::default();
    cfg.root = Some("/".to_string());
    cfg.bucket = "test".to_string();

    let builder = cfg.into_builder();
    let builder = builder.http_client(HttpClient::new()?);

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

    Ok(())
}

Required Associated Types§

source

type Builder: Builder

Associated builder for this configuration.

Required Methods§

source

fn into_builder(self) -> Self::Builder

Convert this configuration into a service builder.

Provided Methods§

source

fn from_iter(iter: impl IntoIterator<Item = (String, String)>) -> Result<Self>

Deserialize from an iterator.

This API is provided by opendal, developer should not implement it.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Configurator for ()

§

type Builder = ()

source§

fn into_builder(self) -> Self::Builder

Implementors§

source§

impl Configurator for AliyunDriveConfig

Available on crate feature services-aliyun-drive only.
source§

impl Configurator for AlluxioConfig

Available on crate feature services-alluxio only.
source§

impl Configurator for AtomicserverConfig

Available on crate feature services-atomicserver only.
source§

impl Configurator for AzblobConfig

Available on crate feature services-azblob only.
source§

impl Configurator for AzdlsConfig

Available on crate feature services-azdls only.
source§

impl Configurator for AzfileConfig

Available on crate feature services-azfile only.
source§

impl Configurator for B2Config

Available on crate feature services-b2 only.
source§

impl Configurator for CacacheConfig

Available on crate feature services-cacache only.
source§

impl Configurator for ChainsafeConfig

Available on crate feature services-chainsafe only.
source§

impl Configurator for CloudflareKvConfig

Available on crate feature services-cloudflare-kv only.
source§

impl Configurator for CompfsConfig

Available on crate feature services-compfs only.
source§

impl Configurator for CosConfig

Available on crate feature services-cos only.
source§

impl Configurator for D1Config

Available on crate feature services-d1 only.
source§

impl Configurator for DashmapConfig

Available on crate feature services-dashmap only.
source§

impl Configurator for DbfsConfig

Available on crate feature services-dbfs only.
source§

impl Configurator for DropboxConfig

Available on crate feature services-dropbox only.
source§

impl Configurator for EtcdConfig

Available on crate feature services-etcd only.
source§

impl Configurator for FoundationdbConfig

Available on crate feature services-foundationdb only.
source§

impl Configurator for FsConfig

Available on crate feature services-fs only.
source§

impl Configurator for FtpConfig

Available on crate feature services-ftp only.
source§

impl Configurator for GcsConfig

Available on crate feature services-gcs only.
source§

impl Configurator for GdriveConfig

Available on crate feature services-gdrive only.
source§

impl Configurator for GhacConfig

Available on crate feature services-ghac only.
source§

impl Configurator for GithubConfig

Available on crate feature services-github only.
source§

impl Configurator for GridfsConfig

Available on crate feature services-gridfs only.
source§

impl Configurator for HdfsConfig

Available on crate feature services-hdfs only.
source§

impl Configurator for HdfsNativeConfig

Available on crate feature services-hdfs-native only.
source§

impl Configurator for HttpConfig

Available on crate feature services-http only.
source§

impl Configurator for HuggingfaceConfig

Available on crate feature services-huggingface only.
source§

impl Configurator for IcloudConfig

Available on crate feature services-icloud only.
source§

impl Configurator for IpfsConfig

Available on crate feature services-ipfs only.
source§

impl Configurator for IpmfsConfig

Available on crate feature services-ipmfs only.
source§

impl Configurator for KoofrConfig

Available on crate feature services-koofr only.
source§

impl Configurator for LakefsConfig

Available on crate feature services-lakefs only.
source§

impl Configurator for LibsqlConfig

Available on crate feature services-libsql only.
source§

impl Configurator for MemcachedConfig

Available on crate feature services-memcached only.
source§

impl Configurator for MemoryConfig

Available on crate feature services-memory only.
source§

impl Configurator for MiniMokaConfig

Available on crate feature services-mini-moka only.
source§

impl Configurator for MokaConfig

Available on crate feature services-moka only.
source§

impl Configurator for MongodbConfig

Available on crate feature services-mongodb only.
source§

impl Configurator for MonoiofsConfig

Available on crate feature services-monoiofs only.
source§

impl Configurator for MysqlConfig

Available on crate feature services-mysql only.
source§

impl Configurator for NebulaGraphConfig

Available on crate feature services-nebula-graph only.
source§

impl Configurator for ObsConfig

Available on crate feature services-obs only.
source§

impl Configurator for OnedriveConfig

Available on crate feature services-onedrive only.
source§

impl Configurator for OssConfig

Available on crate feature services-oss only.
source§

impl Configurator for PcloudConfig

Available on crate feature services-pcloud only.
source§

impl Configurator for PersyConfig

Available on crate feature services-persy only.
source§

impl Configurator for PostgresqlConfig

Available on crate feature services-postgresql only.
source§

impl Configurator for RedbConfig

Available on crate feature services-redb only.
source§

impl Configurator for RedisConfig

Available on crate feature services-redis only.
source§

impl Configurator for RocksdbConfig

Available on crate feature services-rocksdb only.
source§

impl Configurator for S3Config

Available on crate feature services-s3 only.
source§

impl Configurator for SeafileConfig

Available on crate feature services-seafile only.
source§

impl Configurator for SftpConfig

Available on crate feature services-sftp only.
source§

impl Configurator for SledConfig

Available on crate feature services-sled only.
source§

impl Configurator for SqliteConfig

Available on crate feature services-sqlite only.
source§

impl Configurator for SupabaseConfig

Available on crate feature services-supabase only.
source§

impl Configurator for SurrealdbConfig

Available on crate feature services-surrealdb only.
source§

impl Configurator for SwiftConfig

Available on crate feature services-swift only.
source§

impl Configurator for TikvConfig

Available on crate feature services-tikv only.
source§

impl Configurator for UpyunConfig

Available on crate feature services-upyun only.
source§

impl Configurator for VercelArtifactsConfig

Available on crate feature services-vercel-artifacts only.
source§

impl Configurator for VercelBlobConfig

Available on crate feature services-vercel-blob only.
source§

impl Configurator for WebdavConfig

Available on crate feature services-webdav only.
source§

impl Configurator for WebhdfsConfig

Available on crate feature services-webhdfs only.
source§

impl Configurator for YandexDiskConfig

Available on crate feature services-yandex-disk only.