| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Builder is used to set up underlying services."><title>Builder in opendal_core - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="opendal_core" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (be0ade2b6 2025-10-11)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js"><script src="../static.files/storage-e2aeef58.js"></script><script defer="" src="sidebar-items.js"></script><script defer="" src="../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Builder</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../opendal_core/index.html"><img src="/img/external/71c0d8847d34b7f8ce3fd204c652c6f9.svg" alt="logo"></a><h2><a href="../opendal_core/index.html">opendal_<wbr>core</a><span class="version">0.55.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Builder</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Config" title="Config">Config</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.build" title="build">build</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Builder-for-()" title="()">()</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate opendal_<wbr>core</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">opendal_core</a></div><h1>Trait <span class="trait">Builder</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/opendal_core/types/builder.rs.html#52-58">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Builder: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + 'static { |
| type <a href="#associatedtype.Config" class="associatedtype">Config</a>: <a class="trait" href="trait.Configurator.html" title="trait opendal_core::Configurator">Configurator</a>; |
| |
| // Required method |
| fn <a href="#tymethod.build" class="fn">build</a>(self) -> <a class="type" href="type.Result.html" title="type opendal_core::Result">Result</a><impl <a class="trait" href="raw/trait.Access.html" title="trait opendal_core::raw::Access">Access</a>>; |
| }</code></pre><details class="toggle top-doc" open=""><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Builder is used to set up underlying services.</p> |
| <p>This trait allows the developer to define a builder struct that can:</p> |
| <ul> |
| <li>build a service via builder style API.</li> |
| <li>configure in-memory options like <code>customized_credential_load</code>.</li> |
| </ul> |
| <p>Usually, users don’t need to use or import this trait directly, they can use <code>Operator</code> API instead.</p> |
| <p>For example:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal_core::services::Memory; |
| <span class="kw">use </span>opendal_core::Operator; |
| <span class="kw">async fn </span>test() -> <span class="prelude-ty">Result</span><()> { |
| <span class="comment">// Create memory backend builder. |
| </span><span class="kw">let </span>builder = Memory::default(); |
| |
| <span class="comment">// Build an `Operator` to start operating the storage. |
| </span><span class="kw">let </span>op: Operator = Operator::new(builder)<span class="question-mark">?</span>.finish(); |
| |
| <span class="prelude-val">Ok</span>(()) |
| }</code></pre></div></div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open=""><summary><section id="associatedtype.Config" class="method"><a class="src rightside" href="../src/opendal_core/types/builder.rs.html#54">Source</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a>: <a class="trait" href="trait.Configurator.html" title="trait opendal_core::Configurator">Configurator</a></h4></section></summary><div class="docblock"><p>Associated configuration for this builder.</p> |
| </div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open=""><summary><section id="tymethod.build" class="method"><a class="src rightside" href="../src/opendal_core/types/builder.rs.html#57">Source</a><h4 class="code-header">fn <a href="#tymethod.build" class="fn">build</a>(self) -> <a class="type" href="type.Result.html" title="type opendal_core::Result">Result</a><impl <a class="trait" href="raw/trait.Access.html" title="trait opendal_core::raw::Access">Access</a>></h4></section></summary><div class="docblock"><p>Consume the accessor builder to build a service.</p> |
| </div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-()" class="impl"><a class="src rightside" href="../src/opendal_core/types/builder.rs.html#61-67">Source</a><a href="#impl-Builder-for-()" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a></h3><div class="docblock"><p>Dummy implementation of builder</p> |
| </div></section></summary><div class="impl-items"><section id="associatedtype.Config-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/types/builder.rs.html#62">Source</a><a href="#associatedtype.Config-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a></h4></section><section id="method.build" class="method trait-impl"><a class="src rightside" href="../src/opendal_core/types/builder.rs.html#64-66">Source</a><a href="#method.build" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.build" class="fn">build</a>(self) -> <a class="type" href="type.Result.html" title="type opendal_core::Result">Result</a><impl <a class="trait" href="raw/trait.Access.html" title="trait opendal_core::raw::Access">Access</a>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-GridfsBuilder" class="impl"><a class="src rightside" href="../src/opendal_core/services/gridfs/backend.rs.html#106-149">Source</a><a href="#impl-Builder-for-GridfsBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="struct" href="services/struct.Gridfs.html" title="struct opendal_core::services::Gridfs">GridfsBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>services-gridfs</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Config-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/services/gridfs/backend.rs.html#107">Source</a><a href="#associatedtype.Config-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="struct" href="services/struct.GridfsConfig.html" title="struct opendal_core::services::GridfsConfig">GridfsConfig</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-HdfsBuilder" class="impl"><a class="src rightside" href="../src/opendal_core/services/hdfs/backend.rs.html#109-190">Source</a><a href="#impl-Builder-for-HdfsBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="struct" href="services/struct.Hdfs.html" title="struct opendal_core::services::Hdfs">HdfsBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>services-hdfs</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Config-3" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/services/hdfs/backend.rs.html#110">Source</a><a href="#associatedtype.Config-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="struct" href="services/struct.HdfsConfig.html" title="struct opendal_core::services::HdfsConfig">HdfsConfig</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-IpmfsBuilder" class="impl"><a class="src rightside" href="../src/opendal_core/services/ipmfs/builder.rs.html#108-148">Source</a><a href="#impl-Builder-for-IpmfsBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="struct" href="services/struct.Ipmfs.html" title="struct opendal_core::services::Ipmfs">IpmfsBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>services-ipmfs</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Config-4" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/services/ipmfs/builder.rs.html#109">Source</a><a href="#associatedtype.Config-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="struct" href="services/struct.IpmfsConfig.html" title="struct opendal_core::services::IpmfsConfig">IpmfsConfig</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-MemoryBuilder" class="impl"><a class="src rightside" href="../src/opendal_core/services/memory/backend.rs.html#46-55">Source</a><a href="#impl-Builder-for-MemoryBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="struct" href="services/struct.Memory.html" title="struct opendal_core::services::Memory">MemoryBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>services-memory</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Config-5" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/services/memory/backend.rs.html#47">Source</a><a href="#associatedtype.Config-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="struct" href="services/struct.MemoryConfig.html" title="struct opendal_core::services::MemoryConfig">MemoryConfig</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-MongodbBuilder" class="impl"><a class="src rightside" href="../src/opendal_core/services/mongodb/backend.rs.html#113-167">Source</a><a href="#impl-Builder-for-MongodbBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="struct" href="services/struct.Mongodb.html" title="struct opendal_core::services::Mongodb">MongodbBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>services-mongodb</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Config-6" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/services/mongodb/backend.rs.html#114">Source</a><a href="#associatedtype.Config-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="struct" href="services/struct.MongodbConfig.html" title="struct opendal_core::services::MongodbConfig">MongodbConfig</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-MonoiofsBuilder" class="impl"><a class="src rightside" href="../src/opendal_core/services/monoiofs/backend.rs.html#55-88">Source</a><a href="#impl-Builder-for-MonoiofsBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="struct" href="services/struct.Monoiofs.html" title="struct opendal_core::services::Monoiofs">MonoiofsBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>services-monoiofs</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Config-7" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/services/monoiofs/backend.rs.html#56">Source</a><a href="#associatedtype.Config-7" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="struct" href="services/struct.MonoiofsConfig.html" title="struct opendal_core::services::MonoiofsConfig">MonoiofsConfig</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-RedisBuilder" class="impl"><a class="src rightside" href="../src/opendal_core/services/redis/backend.rs.html#142-202">Source</a><a href="#impl-Builder-for-RedisBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="struct" href="services/struct.Redis.html" title="struct opendal_core::services::Redis">RedisBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>services-redis</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Config-8" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/services/redis/backend.rs.html#143">Source</a><a href="#associatedtype.Config-8" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="struct" href="services/struct.RedisConfig.html" title="struct opendal_core::services::RedisConfig">RedisConfig</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-RocksdbBuilder" class="impl"><a class="src rightside" href="../src/opendal_core/services/rocksdb/backend.rs.html#59-78">Source</a><a href="#impl-Builder-for-RocksdbBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="struct" href="services/struct.Rocksdb.html" title="struct opendal_core::services::Rocksdb">RocksdbBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>services-rocksdb</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Config-9" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/services/rocksdb/backend.rs.html#60">Source</a><a href="#associatedtype.Config-9" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="struct" href="services/struct.RocksdbConfig.html" title="struct opendal_core::services::RocksdbConfig">RocksdbConfig</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-SftpBuilder" class="impl"><a class="src rightside" href="../src/opendal_core/services/sftp/backend.rs.html#126-201">Source</a><a href="#impl-Builder-for-SftpBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="struct" href="services/struct.Sftp.html" title="struct opendal_core::services::Sftp">SftpBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>services-sftp</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Config-10" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/services/sftp/backend.rs.html#127">Source</a><a href="#associatedtype.Config-10" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="struct" href="services/struct.SftpConfig.html" title="struct opendal_core::services::SftpConfig">SftpConfig</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-WebdavBuilder" class="impl"><a class="src rightside" href="../src/opendal_core/services/webdav/backend.rs.html#107-183">Source</a><a href="#impl-Builder-for-WebdavBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="struct" href="services/struct.Webdav.html" title="struct opendal_core::services::Webdav">WebdavBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>services-webdav</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Config-11" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/services/webdav/backend.rs.html#108">Source</a><a href="#associatedtype.Config-11" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="struct" href="services/struct.WebdavConfig.html" title="struct opendal_core::services::WebdavConfig">WebdavConfig</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Builder-for-WebhdfsBuilder" class="impl"><a class="src rightside" href="../src/opendal_core/services/webhdfs/backend.rs.html#134-203">Source</a><a href="#impl-Builder-for-WebhdfsBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Builder.html" title="trait opendal_core::Builder">Builder</a> for <a class="struct" href="services/struct.Webhdfs.html" title="struct opendal_core::services::Webhdfs">WebhdfsBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>services-webhdfs</code></strong> only.</div></span></section></summary><div class="impl-items"><section id="associatedtype.Config-12" class="associatedtype trait-impl"><a class="src rightside" href="../src/opendal_core/services/webhdfs/backend.rs.html#135">Source</a><a href="#associatedtype.Config-12" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Config" class="associatedtype">Config</a> = <a class="struct" href="services/struct.WebhdfsConfig.html" title="struct opendal_core::services::WebhdfsConfig">WebhdfsConfig</a></h4></section></div></details></div><script src="../trait.impl/opendal_core/types/builder/trait.Builder.js" data-ignore-extern-crates="std" async=""></script></section></div></main></body></html> |