mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-11 15:52:55 +00:00
1291 lines
225 KiB
HTML
1291 lines
225 KiB
HTML
<!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="The `Operator` serves as the entry point for all public asynchronous APIs."><title>ObjectStore in object_store - 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-e56847b5.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="object_store" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (fa3155a64 2025-09-30)" data-channel="nightly" data-search-js="search-e256b49e.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 struct"><!--[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="#">ObjectStore</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../object_store/index.html">object_<wbr>store</a><span class="version">1.0.0-beta.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Object<wbr>Store</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#build" title="Build">Build</a></li><li><a href="#layer" title="Layer">Layer</a></li><li><a href="#operate" title="Operate">Operate</a></li></ul><h3><a href="#fields">Fields</a></h3><ul class="block structfield"><li><a href="#structfield.accessor" title="accessor">accessor</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.check" title="check">check</a></li><li><a href="#method.copy" title="copy">copy</a></li><li><a href="#method.create_dir" title="create_dir">create_dir</a></li><li><a href="#method.delete" title="delete">delete</a></li><li><a href="#method.delete_iter" title="delete_iter">delete_iter</a></li><li><a href="#method.delete_options" title="delete_options">delete_options</a></li><li><a href="#method.delete_stream" title="delete_stream">delete_stream</a></li><li><a href="#method.delete_try_iter" title="delete_try_iter">delete_try_iter</a></li><li><a href="#method.delete_try_stream" title="delete_try_stream">delete_try_stream</a></li><li><a href="#method.delete_with" title="delete_with">delete_with</a></li><li><a href="#method.deleter" title="deleter">deleter</a></li><li><a href="#method.executor" title="executor">executor</a></li><li><a href="#method.exists" title="exists">exists</a></li><li><a href="#method.from_config" title="from_config">from_config</a></li><li><a href="#method.from_inner" title="from_inner">from_inner</a></li><li><a href="#method.from_iter" title="from_iter">from_iter</a></li><li><a href="#method.from_map" title="from_map">from_map</a></li><li><a href="#method.http_client" title="http_client">http_client</a></li><li><a href="#method.info" title="info">info</a></li><li><a href="#method.inner" title="inner">inner</a></li><li><a href="#method.into_inner" title="into_inner">into_inner</a></li><li><a href="#method.layer" title="layer">layer</a></li><li><a href="#method.list" title="list">list</a></li><li><a href="#method.list_options" title="list_options">list_options</a></li><li><a href="#method.list_with" title="list_with">list_with</a></li><li><a href="#method.lister" title="lister">lister</a></li><li><a href="#method.lister_options" title="lister_options">lister_options</a></li><li><a href="#method.lister_with" title="lister_with">lister_with</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.presign_delete" title="presign_delete">presign_delete</a></li><li><a href="#method.presign_delete_options" title="presign_delete_options">presign_delete_options</a></li><li><a href="#method.presign_delete_with" title="presign_delete_with">presign_delete_with</a></li><li><a href="#method.presign_read" title="presign_read">presign_read</a></li><li><a href="#method.presign_read_options" title="presign_read_options">presign_read_options</a></li><li><a href="#method.presign_read_with" title="presign_read_with">presign_read_with</a></li><li><a href="#method.presign_stat" title="presign_stat">presign_stat</a></li><li><a href="#method.presign_stat_options" title="presign_stat_options">presign_stat_options</a></li><li><a href="#method.presign_stat_with" title="presign_stat_with">presign_stat_with</a></li><li><a href="#method.presign_write" title="presign_write">presign_write</a></li><li><a href="#method.presign_write_options" title="presign_write_options">presign_write_options</a></li><li><a href="#method.presign_write_with" title="presign_write_with">presign_write_with</a></li><li><a href="#method.read" title="read">read</a></li><li><a href="#method.read_options" title="read_options">read_options</a></li><li><a href="#method.read_with" title="read_with">read_with</a></li><li><a href="#method.reader" title="reader">reader</a></li><li><a href="#method.reader_options" title="reader_options">reader_options</a></li><li><a href="#method.reader_with" title="reader_with">reader_with</a></li><li><a href="#method.remove_all" title="remove_all">remove_all</a></li><li><a href="#method.rename" title="rename">rename</a></li><li><a href="#method.stat" title="stat">stat</a></li><li><a href="#method.stat_options" title="stat_options">stat_options</a></li><li><a href="#method.stat_with" title="stat_with">stat_with</a></li><li><a href="#method.update_executor" title="update_executor">update_executor</a></li><li><a href="#method.update_http_client" title="update_http_client">update_http_client</a></li><li><a href="#method.via_iter" title="via_iter">via_iter</a></li><li><a href="#method.via_map" title="via_map">via_map</a></li><li><a href="#method.write" title="write">write</a></li><li><a href="#method.write_options" title="write_options">write_options</a></li><li><a href="#method.write_with" title="write_with">write_with</a></li><li><a href="#method.writer" title="writer">writer</a></li><li><a href="#method.writer_options" title="writer_options">writer_options</a></li><li><a href="#method.writer_with" title="writer_with">writer_with</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Clone-for-Operator" title="Clone">Clone</a></li><li><a href="#impl-Debug-for-Operator" title="Debug">Debug</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-Operator" title="!RefUnwindSafe">!RefUnwindSafe</a></li><li><a href="#impl-UnwindSafe-for-Operator" title="!UnwindSafe">!UnwindSafe</a></li><li><a href="#impl-Freeze-for-Operator" title="Freeze">Freeze</a></li><li><a href="#impl-Send-for-Operator" title="Send">Send</a></li><li><a href="#impl-Sync-for-Operator" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-Operator" title="Unpin">Unpin</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Any-for-T-1" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-CloneAny-for-T" title="CloneAny">CloneAny</a></li><li><a href="#impl-CloneAnySend-for-T" title="CloneAnySend">CloneAnySend</a></li><li><a href="#impl-CloneAnySendSync-for-T" title="CloneAnySendSync">CloneAnySendSync</a></li><li><a href="#impl-CloneAnySync-for-T" title="CloneAnySync">CloneAnySync</a></li><li><a href="#impl-CloneToUninit-for-T" title="CloneToUninit">CloneToUninit</a></li><li><a href="#impl-Conv-for-T" title="Conv">Conv</a></li><li><a href="#impl-ErasedDestructor-for-T" title="ErasedDestructor">ErasedDestructor</a></li><li><a href="#impl-FmtForward-for-T" title="FmtForward">FmtForward</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-FromRef%3CT%3E-for-T" title="FromRef<T>">FromRef<T></a></li><li><a href="#impl-FutureExt-for-T" title="FutureExt">FutureExt</a></li><li><a href="#impl-Instrument-for-T" title="Instrument">Instrument</a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-IntoRequest%3CT%3E-for-T" title="IntoRequest<T>">IntoRequest<T></a></li><li><a href="#impl-LayerExt%3CL%3E-for-L" title="LayerExt<L>">LayerExt<L></a></li><li><a href="#impl-MaybeSend-for-T" title="MaybeSend">MaybeSend</a></li><li><a href="#impl-Pipe-for-T" title="Pipe">Pipe</a></li><li><a href="#impl-PolicyExt-for-T" title="PolicyExt">PolicyExt</a></li><li><a href="#impl-Same-for-T" title="Same">Same</a></li><li><a href="#impl-ServiceExt-for-T" title="ServiceExt">ServiceExt</a></li><li><a href="#impl-Tap-for-T" title="Tap">Tap</a></li><li><a href="#impl-ToOwned-for-T" title="ToOwned">ToOwned</a></li><li><a href="#impl-TryConv-for-T" title="TryConv">TryConv</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li><li><a href="#impl-VZip%3CV%3E-for-T" title="VZip<V>">VZip<V></a></li><li><a href="#impl-WithSubscriber-for-T" title="WithSubscriber">WithSubscriber</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate object_<wbr>store</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">object_store</a></div><h1>Struct <span class="struct">Object<wbr>Store</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub struct ObjectStore {
|
||
accessor: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><dyn AccessDyn>,
|
||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The <code>Operator</code> serves as the entry point for all public asynchronous APIs.</p>
|
||
<p>For more details about the <code>Operator</code>, refer to the [<code>concepts</code>][crate::docs::concepts] section.</p>
|
||
<p>All cloned <code>Operator</code> instances share the same internal state, such as
|
||
<code>HttpClient</code> and <code>Runtime</code>. Some layers may modify the internal state of
|
||
the <code>Operator</code> too like inject logging and metrics for <code>HttpClient</code>.</p>
|
||
<h3 id="build"><a class="doc-anchor" href="#build">§</a>Build</h3>
|
||
<p>Users can initialize an <code>Operator</code> through the following methods:</p>
|
||
<ul>
|
||
<li><a href="struct.ObjectStore.html#method.new" title="associated function object_store::ObjectStore::new"><code>Operator::new</code></a>: Creates an operator using a <a href="services/index.html" title="mod object_store::services"><code>services</code></a> builder, such as <a href="services/struct.S3.html" title="struct object_store::services::S3"><code>services::S3</code></a>.</li>
|
||
<li><a href="struct.ObjectStore.html#method.from_config" title="associated function object_store::ObjectStore::from_config"><code>Operator::from_config</code></a>: Creates an operator using a <a href="services/index.html" title="mod object_store::services"><code>services</code></a> configuration, such as <a href="services/struct.S3Config.html" title="struct object_store::services::S3Config"><code>services::S3Config</code></a>.</li>
|
||
<li><a href="struct.ObjectStore.html#method.from_iter" title="associated function object_store::ObjectStore::from_iter"><code>Operator::from_iter</code></a>: Creates an operator from an iterator of configuration key-value pairs.</li>
|
||
</ul>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::services::Memory;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">async fn </span>test() -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="comment">// Build an `Operator` to start operating the storage.
|
||
</span><span class="kw">let _</span>: Operator = Operator::new(Memory::default())<span class="question-mark">?</span>.finish();
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div><h3 id="layer"><a class="doc-anchor" href="#layer">§</a>Layer</h3>
|
||
<p>After the operator is built, users can add the layers they need on top of it.</p>
|
||
<p>OpenDAL offers various layers for users to choose from, such as <code>RetryLayer</code>, <code>LoggingLayer</code>, and more. Visit [<code>layers</code>] for further details.</p>
|
||
<p>Please note that <code>Layer</code> can modify internal contexts such as <code>HttpClient</code>
|
||
and <code>Runtime</code> for all clones of given operator. Therefore, it is recommended
|
||
to add layers before interacting with the storage. Adding or duplicating
|
||
layers after accessing the storage may result in unexpected behavior.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::layers::RetryLayer;
|
||
<span class="kw">use </span>opendal::services::Memory;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">async fn </span>test() -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>op: Operator = Operator::new(Memory::default())<span class="question-mark">?</span>.finish();
|
||
|
||
<span class="comment">// OpenDAL will retry failed operations now.
|
||
</span><span class="kw">let </span>op = op.layer(RetryLayer::default());
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div><h3 id="operate"><a class="doc-anchor" href="#operate">§</a>Operate</h3>
|
||
<p>After the operator is built and the layers are added, users can start operating the storage.</p>
|
||
<p>The operator is <code>Send</code>, <code>Sync</code>, and <code>Clone</code>. It has no internal state, and all APIs only take
|
||
a <code>&self</code> reference, making it safe to share the operator across threads.</p>
|
||
<p>Operator provides a consistent API pattern for data operations. For reading operations, it exposes:</p>
|
||
<ul>
|
||
<li><a href="struct.ObjectStore.html#method.read" title="method object_store::ObjectStore::read"><code>Operator::read</code></a>: Executes a read operation.</li>
|
||
<li><a href="struct.ObjectStore.html#method.read_with" title="method object_store::ObjectStore::read_with"><code>Operator::read_with</code></a>: Executes a read operation with additional options using the builder pattern.</li>
|
||
<li><a href="struct.ObjectStore.html#method.read_options" title="method object_store::ObjectStore::read_options"><code>Operator::read_options</code></a>: Executes a read operation with extra options provided via a [<code>options::ReadOptions</code>] struct.</li>
|
||
<li><a href="struct.ObjectStore.html#method.reader" title="method object_store::ObjectStore::reader"><code>Operator::reader</code></a>: Creates a reader for streaming data, allowing for flexible access.</li>
|
||
<li><a href="struct.ObjectStore.html#method.reader_with" title="method object_store::ObjectStore::reader_with"><code>Operator::reader_with</code></a>: Creates a reader with advanced options using the builder pattern.</li>
|
||
<li><a href="struct.ObjectStore.html#method.reader_options" title="method object_store::ObjectStore::reader_options"><code>Operator::reader_options</code></a>: Creates a reader with extra options provided via a [<code>options::ReadOptions</code>] struct.</li>
|
||
</ul>
|
||
<p>The <a href="struct.Reader.html" title="struct object_store::Reader"><code>Reader</code></a> created by <a href="struct.ObjectStore.html" title="struct object_store::ObjectStore"><code>Operator</code></a> supports custom read control methods and can be converted
|
||
into [<code>futures::AsyncRead</code>] or [<code>futures::Stream</code>] for broader ecosystem compatibility.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::layers::LoggingLayer;
|
||
<span class="kw">use </span>opendal::options;
|
||
<span class="kw">use </span>opendal::services;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">use </span>opendal::Result;
|
||
|
||
<span class="attr">#[tokio::main]
|
||
</span><span class="kw">async fn </span>main() -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="comment">// Pick a builder and configure it.
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>builder = services::S3::default().bucket(<span class="string">"test"</span>);
|
||
|
||
<span class="comment">// Init an operator
|
||
</span><span class="kw">let </span>op = Operator::new(builder)<span class="question-mark">?
|
||
</span><span class="comment">// Init with logging layer enabled.
|
||
</span>.layer(LoggingLayer::default())
|
||
.finish();
|
||
|
||
<span class="comment">// Fetch this file's metadata
|
||
</span><span class="kw">let </span>meta = op.stat(<span class="string">"hello.txt"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">let </span>length = meta.content_length();
|
||
|
||
<span class="comment">// Read data from `hello.txt` with options.
|
||
</span><span class="kw">let </span>bs = op
|
||
.read_with(<span class="string">"hello.txt"</span>)
|
||
.range(<span class="number">0</span>..<span class="number">8 </span>* <span class="number">1024 </span>* <span class="number">1024</span>)
|
||
.chunk(<span class="number">1024 </span>* <span class="number">1024</span>)
|
||
.concurrent(<span class="number">4</span>)
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||
|
||
<span class="comment">// The same to:
|
||
</span><span class="kw">let </span>bs = op
|
||
.read_options(<span class="string">"hello.txt"</span>, options::ReadOptions {
|
||
range: (<span class="number">0</span>..<span class="number">8 </span>* <span class="number">1024 </span>* <span class="number">1024</span>).into(),
|
||
chunk: <span class="prelude-val">Some</span>(<span class="number">1024 </span>* <span class="number">1024</span>),
|
||
concurrent: <span class="number">4</span>,
|
||
..Default::default()
|
||
})
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div></div></details><h2 id="fields" class="fields section-header">Fields<a href="#fields" class="anchor">§</a></h2><span id="structfield.accessor" class="structfield section-header"><a href="#structfield.accessor" class="anchor field">§</a><code>accessor: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><dyn AccessDyn></code></span><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Operator" class="impl"><a href="#impl-Operator" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3><div class="docblock"><h4 id="operator-basic-api"><a class="doc-anchor" href="#operator-basic-api">§</a>Operator basic API.</h4></div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.inner" class="method"><h4 class="code-header">pub fn <a href="#method.inner" class="fn">inner</a>(&self) -> &<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><dyn AccessDyn></h4></section></summary><div class="docblock"><p>Fetch the internal accessor.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_inner" class="method"><h4 class="code-header">pub fn <a href="#method.from_inner" class="fn">from_inner</a>(accessor: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><dyn AccessDyn>) -> <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h4></section></summary><div class="docblock"><p>Convert inner accessor into operator.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_inner" class="method"><h4 class="code-header">pub fn <a href="#method.into_inner" class="fn">into_inner</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><dyn AccessDyn></h4></section></summary><div class="docblock"><p>Convert operator into inner accessor.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.info" class="method"><h4 class="code-header">pub fn <a href="#method.info" class="fn">info</a>(&self) -> OperatorInfo</h4></section></summary><div class="docblock"><p>Get information of underlying accessor.</p>
|
||
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::Operator;
|
||
|
||
<span class="kw">let </span>info = op.info();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.executor" class="method"><h4 class="code-header">pub fn <a href="#method.executor" class="fn">executor</a>(&self) -> Executor</h4></section></summary><div class="docblock"><p>Get the executor used by current operator.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.update_executor" class="method"><h4 class="code-header">pub fn <a href="#method.update_executor" class="fn">update_executor</a>(&self, f: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Executor) -> Executor)</h4></section></summary><div class="docblock"><p>Update executor for the context.</p>
|
||
<p>All cloned <code>Operator</code> instances share the same internal state, such as
|
||
<code>HttpClient</code> and <code>Runtime</code>. Some layers may modify the internal state of
|
||
the <code>Operator</code> too like inject logging and metrics for <code>HttpClient</code>.</p>
|
||
<h5 id="note"><a class="doc-anchor" href="#note">§</a>Note</h5>
|
||
<p>Tasks must be forwarded to the old executor after the update. Otherwise, features such as retry, timeout, and metrics may not function properly.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.http_client" class="method"><h4 class="code-header">pub fn <a href="#method.http_client" class="fn">http_client</a>(&self) -> <a class="struct" href="struct.HttpClient.html" title="struct object_store::HttpClient">HttpClient</a></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.54.0: Use HttpClientLayer instead. This method will be removed in next version.</span></div></span></summary><div class="docblock"><p>Get the http client used by current operator.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.update_http_client" class="method"><h4 class="code-header">pub fn <a href="#method.update_http_client" class="fn">update_http_client</a>(&self, f: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="struct" href="struct.HttpClient.html" title="struct object_store::HttpClient">HttpClient</a>) -> <a class="struct" href="struct.HttpClient.html" title="struct object_store::HttpClient">HttpClient</a>)</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.54.0: Use HttpClientLayer instead. This method will be removed in next version</span></div></span></summary><div class="docblock"><p>Update http client for the context.</p>
|
||
<p>All cloned <code>Operator</code> instances share the same internal state, such as
|
||
<code>HttpClient</code> and <code>Runtime</code>. Some layers may modify the internal state of
|
||
the <code>Operator</code> too like inject logging and metrics for <code>HttpClient</code>.</p>
|
||
<h5 id="note-1"><a class="doc-anchor" href="#note-1">§</a>Note</h5>
|
||
<p>Tasks must be forwarded to the old executor after the update. Otherwise, features such as retry, timeout, and metrics may not function properly.</p>
|
||
<h5 id="deprecated"><a class="doc-anchor" href="#deprecated">§</a>Deprecated</h5>
|
||
<p>This method is deprecated since v0.54.0. Use <a href="layers/struct.HttpClientLayer.html" title="struct object_store::layers::HttpClientLayer"><code>HttpClientLayer</code></a> instead.</p>
|
||
<h6 id="migration-example"><a class="doc-anchor" href="#migration-example">§</a>Migration Example</h6>
|
||
<p>Instead of:</p>
|
||
|
||
<div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">let </span>operator = Operator::new(service)<span class="question-mark">?</span>;
|
||
operator.update_http_client(|<span class="kw">_</span>| custom_client);</code></pre></div>
|
||
<p>Use:</p>
|
||
|
||
<div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::layers::HttpClientLayer;
|
||
|
||
<span class="kw">let </span>operator = Operator::new(service)<span class="question-mark">?
|
||
</span>.layer(HttpClientLayer::new(custom_client))
|
||
.finish();</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Operator-1" class="impl"><a href="#impl-Operator-1" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3><div class="docblock"><h4 id="operator-async-api"><a class="doc-anchor" href="#operator-async-api">§</a>Operator async API.</h4></div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.check" class="method"><h4 class="code-header">pub async fn <a href="#method.check" class="fn">check</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Check if this operator can work correctly.</p>
|
||
<p>We will send a <code>list</code> request to path and return any errors we met.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::Operator;
|
||
|
||
op.check().<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.stat" class="method"><h4 class="code-header">pub async fn <a href="#method.stat" class="fn">stat</a>(&self, path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="layers/mock/struct.Metadata.html" title="struct object_store::layers::mock::Metadata">Metadata</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Retrieve the metadata for the specified path.</p>
|
||
<h5 id="notes"><a class="doc-anchor" href="#notes">§</a>Notes</h5><h6 id="extra-options"><a class="doc-anchor" href="#extra-options">§</a>Extra Options</h6>
|
||
<p><a href="struct.ObjectStore.html#method.stat" title="method object_store::ObjectStore::stat"><code>Operator::stat</code></a> is a wrapper around <a href="struct.ObjectStore.html#method.stat_with" title="method object_store::ObjectStore::stat_with"><code>Operator::stat_with</code></a> that uses no additional options.
|
||
To specify extra options such as <code>if_match</code> and <code>if_none_match</code>, please use <a href="struct.ObjectStore.html#method.stat_with" title="method object_store::ObjectStore::stat_with"><code>Operator::stat_with</code></a> instead.</p>
|
||
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5><h6 id="check-if-file-exists"><a class="doc-anchor" href="#check-if-file-exists">§</a>Check if file exists</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::ErrorKind;
|
||
<span class="kw">if let </span><span class="prelude-val">Err</span>(e) = op.stat(<span class="string">"test"</span>).<span class="kw">await </span>{
|
||
<span class="kw">if </span>e.kind() == ErrorKind::NotFound {
|
||
<span class="macro">println!</span>(<span class="string">"file not exist"</span>)
|
||
}
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.stat_with" class="method"><h4 class="code-header">pub fn <a href="#method.stat_with" class="fn">stat_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
) -> OperatorFuture<StatOptions, <a class="struct" href="layers/mock/struct.Metadata.html" title="struct object_store::layers::mock::Metadata">Metadata</a>, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="layers/mock/struct.Metadata.html" title="struct object_store::layers::mock::Metadata">Metadata</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>Retrieve the metadata of the specified path with additional options.</p>
|
||
<h5 id="options"><a class="doc-anchor" href="#options">§</a>Options</h5>
|
||
<p>Check [<code>options::StatOptions</code>] for all available options.</p>
|
||
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5><h6 id="get-metadata-while-etag-matches"><a class="doc-anchor" href="#get-metadata-while-etag-matches">§</a>Get metadata while <code>ETag</code> matches</h6>
|
||
<p><code>stat_with</code> will</p>
|
||
<ul>
|
||
<li>return <code>Ok(metadata)</code> if <code>ETag</code> matches</li>
|
||
<li>return <code>Err(error)</code> and <code>error.kind() == ErrorKind::ConditionNotMatch</code> if file exists but
|
||
<code>ETag</code> mismatch</li>
|
||
<li>return <code>Err(err)</code> if other errors occur, for example, <code>NotFound</code>.</li>
|
||
</ul>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::ErrorKind;
|
||
<span class="kw">if let </span><span class="prelude-val">Err</span>(e) = op.stat_with(<span class="string">"test"</span>).if_match(<span class="string">"<etag>"</span>).<span class="kw">await </span>{
|
||
<span class="kw">if </span>e.kind() == ErrorKind::ConditionNotMatch {
|
||
<span class="macro">println!</span>(<span class="string">"file exists, but etag mismatch"</span>)
|
||
}
|
||
<span class="kw">if </span>e.kind() == ErrorKind::NotFound {
|
||
<span class="macro">println!</span>(<span class="string">"file not exist"</span>)
|
||
}
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.stat_options" class="method"><h4 class="code-header">pub async fn <a href="#method.stat_options" class="fn">stat_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
opts: StatOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="layers/mock/struct.Metadata.html" title="struct object_store::layers::mock::Metadata">Metadata</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Retrieve the metadata of the specified path with additional options.</p>
|
||
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5><h6 id="get-metadata-while-etag-matches-1"><a class="doc-anchor" href="#get-metadata-while-etag-matches-1">§</a>Get metadata while <code>ETag</code> matches</h6>
|
||
<p><code>stat_with</code> will</p>
|
||
<ul>
|
||
<li>return <code>Ok(metadata)</code> if <code>ETag</code> matches</li>
|
||
<li>return <code>Err(error)</code> and <code>error.kind() == ErrorKind::ConditionNotMatch</code> if file exists but
|
||
<code>ETag</code> mismatch</li>
|
||
<li>return <code>Err(err)</code> if other errors occur, for example, <code>NotFound</code>.</li>
|
||
</ul>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::options;
|
||
<span class="kw">use </span>opendal::ErrorKind;
|
||
<span class="kw">let </span>res = op
|
||
.stat_options(<span class="string">"test"</span>, options::StatOptions {
|
||
if_match: <span class="prelude-val">Some</span>(<span class="string">"<etag>"</span>.to_string()),
|
||
..Default::default()
|
||
})
|
||
.<span class="kw">await</span>;
|
||
<span class="kw">if let </span><span class="prelude-val">Err</span>(e) = res {
|
||
<span class="kw">if </span>e.kind() == ErrorKind::ConditionNotMatch {
|
||
<span class="macro">println!</span>(<span class="string">"file exists, but etag mismatch"</span>)
|
||
}
|
||
<span class="kw">if </span>e.kind() == ErrorKind::NotFound {
|
||
<span class="macro">println!</span>(<span class="string">"file not exist"</span>)
|
||
}
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.exists" class="method"><h4 class="code-header">pub async fn <a href="#method.exists" class="fn">exists</a>(&self, path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Check whether this path exists.</p>
|
||
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>futures::io;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let _ </span>= op.exists(<span class="string">"test"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.create_dir" class="method"><h4 class="code-header">pub async fn <a href="#method.create_dir" class="fn">create_dir</a>(&self, path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Create a directory at the specified path.</p>
|
||
<h5 id="notes-1"><a class="doc-anchor" href="#notes-1">§</a>Notes</h5>
|
||
<p>To specify that a path is a directory, you must include a trailing slash (/).
|
||
Omitting the trailing slash may cause OpenDAL to return a <code>NotADirectory</code> error.</p>
|
||
<h5 id="behavior"><a class="doc-anchor" href="#behavior">§</a>Behavior</h5>
|
||
<ul>
|
||
<li>Creating a directory that already exists will succeed.</li>
|
||
<li>Directory creation is always recursive, functioning like <code>mkdir -p</code>.</li>
|
||
</ul>
|
||
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>op.create_dir(<span class="string">"path/to/dir/"</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.read" class="method"><h4 class="code-header">pub async fn <a href="#method.read" class="fn">read</a>(&self, path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Buffer.html" title="struct object_store::Buffer">Buffer</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Read the entire file into bytes from given path.</p>
|
||
<h5 id="notes-2"><a class="doc-anchor" href="#notes-2">§</a>Notes</h5><h6 id="additional-options"><a class="doc-anchor" href="#additional-options">§</a>Additional Options</h6>
|
||
<p><a href="struct.ObjectStore.html#method.read" title="method object_store::ObjectStore::read"><code>Operator::read</code></a> is a simplified method that does not support additional options. To access features like <code>range</code> and <code>if_match</code>, please use <a href="struct.ObjectStore.html#method.read_with" title="method object_store::ObjectStore::read_with"><code>Operator::read_with</code></a> or <a href="struct.ObjectStore.html#method.read_options" title="method object_store::ObjectStore::read_options"><code>Operator::read_options</code></a> instead.</p>
|
||
<h6 id="streaming-read"><a class="doc-anchor" href="#streaming-read">§</a>Streaming Read</h6>
|
||
<p>This function reads all content into memory at once. For more precise memory management or to read big file lazily, please use <a href="struct.ObjectStore.html#method.reader" title="method object_store::ObjectStore::reader"><code>Operator::reader</code></a>.</p>
|
||
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>bs = op.read(<span class="string">"path/to/file"</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.read_with" class="method"><h4 class="code-header">pub fn <a href="#method.read_with" class="fn">read_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
) -> OperatorFuture<ReadOptions, <a class="struct" href="struct.Buffer.html" title="struct object_store::Buffer">Buffer</a>, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Buffer.html" title="struct object_store::Buffer">Buffer</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>Read the entire file into bytes from given path with additional options.</p>
|
||
<h5 id="notes-3"><a class="doc-anchor" href="#notes-3">§</a>Notes</h5><h6 id="streaming-read-1"><a class="doc-anchor" href="#streaming-read-1">§</a>Streaming Read</h6>
|
||
<p>This function reads all content into memory at once. For more precise memory management or to read big file lazily, please use <a href="struct.ObjectStore.html#method.reader" title="method object_store::ObjectStore::reader"><code>Operator::reader</code></a>.</p>
|
||
<h5 id="options-1"><a class="doc-anchor" href="#options-1">§</a>Options</h5>
|
||
<p>Visit [<code>options::ReadOptions</code>] for all available options.</p>
|
||
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
|
||
<p>Read the first 10 bytes of a file:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>bs = op.read_with(<span class="string">"path/to/file"</span>).range(<span class="number">0</span>..<span class="number">10</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.read_options" class="method"><h4 class="code-header">pub async fn <a href="#method.read_options" class="fn">read_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
opts: ReadOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Buffer.html" title="struct object_store::Buffer">Buffer</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Read the entire file into bytes from given path with additional options.</p>
|
||
<h5 id="notes-4"><a class="doc-anchor" href="#notes-4">§</a>Notes</h5><h6 id="streaming-read-2"><a class="doc-anchor" href="#streaming-read-2">§</a>Streaming Read</h6>
|
||
<p>This function reads all content into memory at once. For more precise memory management or to read big file lazily, please use <a href="struct.ObjectStore.html#method.reader" title="method object_store::ObjectStore::reader"><code>Operator::reader</code></a>.</p>
|
||
<h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5>
|
||
<p>Read the first 10 bytes of a file:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::options;
|
||
<span class="kw">let </span>bs = op
|
||
.read_options(<span class="string">"path/to/file"</span>, options::ReadOptions {
|
||
range: (<span class="number">0</span>..<span class="number">10</span>).into(),
|
||
..Default::default()
|
||
})
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.reader" class="method"><h4 class="code-header">pub async fn <a href="#method.reader" class="fn">reader</a>(&self, path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Reader.html" title="struct object_store::Reader">Reader</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Create a new reader of given path.</p>
|
||
<h5 id="notes-5"><a class="doc-anchor" href="#notes-5">§</a>Notes</h5><h6 id="extra-options-1"><a class="doc-anchor" href="#extra-options-1">§</a>Extra Options</h6>
|
||
<p><a href="struct.ObjectStore.html#method.reader" title="method object_store::ObjectStore::reader"><code>Operator::reader</code></a> is a simplified method without any options. To use additional options such as <code>concurrent</code> or <code>if_match</code>, please use <a href="struct.ObjectStore.html#method.reader_with" title="method object_store::ObjectStore::reader_with"><code>Operator::reader_with</code></a> or <a href="struct.ObjectStore.html#method.reader_options" title="method object_store::ObjectStore::reader_options"><code>Operator::reader_options</code></a> instead.</p>
|
||
<h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>r = op.reader(<span class="string">"path/to/file"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="comment">// Read the first 10 bytes of the file
|
||
</span><span class="kw">let </span>data = r.read(<span class="number">0</span>..<span class="number">10</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.reader_with" class="method"><h4 class="code-header">pub fn <a href="#method.reader_with" class="fn">reader_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
) -> OperatorFuture<ReaderOptions, <a class="struct" href="struct.Reader.html" title="struct object_store::Reader">Reader</a>, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Reader.html" title="struct object_store::Reader">Reader</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>Create a new reader of given path with additional options.</p>
|
||
<h5 id="options-2"><a class="doc-anchor" href="#options-2">§</a>Options</h5>
|
||
<p>Visit [<code>options::ReaderOptions</code>] for all available options.</p>
|
||
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
|
||
<p>Create a reader with a specific version ID:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>r = op.reader_with(<span class="string">"path/to/file"</span>).version(<span class="string">"version_id"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="comment">// Read the first 10 bytes of the file
|
||
</span><span class="kw">let </span>data = r.read(<span class="number">0</span>..<span class="number">10</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.reader_options" class="method"><h4 class="code-header">pub async fn <a href="#method.reader_options" class="fn">reader_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
opts: ReaderOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Reader.html" title="struct object_store::Reader">Reader</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Create a new reader of given path with additional options.</p>
|
||
<h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5>
|
||
<p>Create a reader with a specific version ID:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::options;
|
||
<span class="kw">let </span>r = op
|
||
.reader_options(<span class="string">"path/to/file"</span>, options::ReaderOptions {
|
||
version: <span class="prelude-val">Some</span>(<span class="string">"version_id"</span>.to_string()),
|
||
..Default::default()
|
||
})
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="comment">// Read the first 10 bytes of the file
|
||
</span><span class="kw">let </span>data = r.read(<span class="number">0</span>..<span class="number">10</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.write" class="method"><h4 class="code-header">pub async fn <a href="#method.write" class="fn">write</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
bs: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="struct.Buffer.html" title="struct object_store::Buffer">Buffer</a>>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="layers/mock/struct.Metadata.html" title="struct object_store::layers::mock::Metadata">Metadata</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Write all data to the specified path at once.</p>
|
||
<h5 id="notes-6"><a class="doc-anchor" href="#notes-6">§</a>Notes</h5>
|
||
<p>Visit [<code>performance::concurrent_write</code>][crate::docs::performance::concurrent_write] for more details on concurrent writes.</p>
|
||
<h6 id="extra-options-2"><a class="doc-anchor" href="#extra-options-2">§</a>Extra Options</h6>
|
||
<p><a href="struct.ObjectStore.html#method.write" title="method object_store::ObjectStore::write"><code>Operator::write</code></a> is a simplified method that does not include additional options.
|
||
For advanced features such as <code>chunk</code> and <code>concurrent</code>, use <a href="struct.ObjectStore.html#method.write_with" title="method object_store::ObjectStore::write_with"><code>Operator::write_with</code></a> or <a href="struct.ObjectStore.html#method.write_options" title="method object_store::ObjectStore::write_options"><code>Operator::write_options</code></a> instead.</p>
|
||
<h6 id="streaming-write"><a class="doc-anchor" href="#streaming-write">§</a>Streaming Write</h6>
|
||
<p>This method executes a single bulk write operation. For more precise memory management
|
||
or to write data in a streaming fashion, use <a href="struct.ObjectStore.html#method.writer" title="method object_store::ObjectStore::writer"><code>Operator::writer</code></a> instead.</p>
|
||
<h6 id="multipart-uploads"><a class="doc-anchor" href="#multipart-uploads">§</a>Multipart Uploads</h6>
|
||
<p>OpenDAL offers multipart upload capabilities through the <a href="struct.Writer.html" title="struct object_store::Writer"><code>Writer</code></a> abstraction,
|
||
automatically managing all upload details for you. You can fine-tune the upload process
|
||
by adjusting the <code>chunk</code> size and the number of <code>concurrent</code> operations using <a href="struct.ObjectStore.html#method.writer_with" title="method object_store::ObjectStore::writer_with"><code>Operator::writer_with</code></a>.</p>
|
||
<h5 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Bytes;
|
||
|
||
op.write(<span class="string">"path/to/file"</span>, <span class="macro">vec!</span>[<span class="number">0</span>; <span class="number">4096</span>]).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.write_with" class="method"><h4 class="code-header">pub fn <a href="#method.write_with" class="fn">write_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
bs: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="struct.Buffer.html" title="struct object_store::Buffer">Buffer</a>>,
|
||
) -> OperatorFuture<(WriteOptions, <a class="struct" href="struct.Buffer.html" title="struct object_store::Buffer">Buffer</a>), <a class="struct" href="layers/mock/struct.Metadata.html" title="struct object_store::layers::mock::Metadata">Metadata</a>, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="layers/mock/struct.Metadata.html" title="struct object_store::layers::mock::Metadata">Metadata</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>Write all data to the specified path at once with additional options.</p>
|
||
<h5 id="notes-7"><a class="doc-anchor" href="#notes-7">§</a>Notes</h5>
|
||
<p>Visit [<code>performance::concurrent_write</code>][crate::docs::performance::concurrent_write] for more details on concurrent writes.</p>
|
||
<h6 id="streaming-write-1"><a class="doc-anchor" href="#streaming-write-1">§</a>Streaming Write</h6>
|
||
<p>This method executes a single bulk write operation. For more precise memory management
|
||
or to write data in a streaming fashion, use <a href="struct.ObjectStore.html#method.writer" title="method object_store::ObjectStore::writer"><code>Operator::writer</code></a> instead.</p>
|
||
<h6 id="multipart-uploads-1"><a class="doc-anchor" href="#multipart-uploads-1">§</a>Multipart Uploads</h6>
|
||
<p>OpenDAL offers multipart upload capabilities through the <a href="struct.Writer.html" title="struct object_store::Writer"><code>Writer</code></a> abstraction,
|
||
automatically managing all upload details for you. You can fine-tune the upload process
|
||
by adjusting the <code>chunk</code> size and the number of <code>concurrent</code> operations using <a href="struct.ObjectStore.html#method.writer_with" title="method object_store::ObjectStore::writer_with"><code>Operator::writer_with</code></a>.</p>
|
||
<h5 id="options-3"><a class="doc-anchor" href="#options-3">§</a>Options</h5>
|
||
<p>Visit [<code>options::WriteOptions</code>] for all available options.</p>
|
||
<h5 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h5>
|
||
<p>Write data to a file only when it does not already exist:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Bytes;
|
||
|
||
<span class="kw">let _ </span>= op
|
||
.write_with(<span class="string">"path/to/file"</span>, <span class="macro">vec!</span>[<span class="number">0</span>; <span class="number">4096</span>])
|
||
.if_not_exists(<span class="bool-val">true</span>)
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.write_options" class="method"><h4 class="code-header">pub async fn <a href="#method.write_options" class="fn">write_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
bs: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="struct.Buffer.html" title="struct object_store::Buffer">Buffer</a>>,
|
||
opts: WriteOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="layers/mock/struct.Metadata.html" title="struct object_store::layers::mock::Metadata">Metadata</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Write all data to the specified path at once with additional options.</p>
|
||
<h5 id="notes-8"><a class="doc-anchor" href="#notes-8">§</a>Notes</h5>
|
||
<p>Visit [<code>performance::concurrent_write</code>][crate::docs::performance::concurrent_write] for more details on concurrent writes.</p>
|
||
<h6 id="streaming-write-2"><a class="doc-anchor" href="#streaming-write-2">§</a>Streaming Write</h6>
|
||
<p>This method executes a single bulk write operation. For more precise memory management
|
||
or to write data in a streaming fashion, use <a href="struct.ObjectStore.html#method.writer" title="method object_store::ObjectStore::writer"><code>Operator::writer</code></a> instead.</p>
|
||
<h6 id="multipart-uploads-2"><a class="doc-anchor" href="#multipart-uploads-2">§</a>Multipart Uploads</h6>
|
||
<p>OpenDAL offers multipart upload capabilities through the <a href="struct.Writer.html" title="struct object_store::Writer"><code>Writer</code></a> abstraction,
|
||
automatically managing all upload details for you. You can fine-tune the upload process
|
||
by adjusting the <code>chunk</code> size and the number of <code>concurrent</code> operations using <a href="struct.ObjectStore.html#method.writer_with" title="method object_store::ObjectStore::writer_with"><code>Operator::writer_with</code></a>.</p>
|
||
<h5 id="examples-13"><a class="doc-anchor" href="#examples-13">§</a>Examples</h5>
|
||
<p>Write data to a file only when it does not already exist:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::options;
|
||
|
||
<span class="kw">let _ </span>= op
|
||
.write_options(<span class="string">"path/to/file"</span>, <span class="macro">vec!</span>[<span class="number">0</span>; <span class="number">4096</span>], options::WriteOptions {
|
||
if_not_exists: <span class="bool-val">true</span>,
|
||
..Default::default()
|
||
})
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.writer" class="method"><h4 class="code-header">pub async fn <a href="#method.writer" class="fn">writer</a>(&self, path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Writer.html" title="struct object_store::Writer">Writer</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Create a new writer of given path.</p>
|
||
<h5 id="notes-9"><a class="doc-anchor" href="#notes-9">§</a>Notes</h5><h6 id="writer-features"><a class="doc-anchor" href="#writer-features">§</a>Writer Features</h6>
|
||
<p>The writer provides several powerful capabilities:</p>
|
||
<ul>
|
||
<li>Streaming writes for continuous data transfer</li>
|
||
<li>Automatic multipart upload handling</li>
|
||
<li>Memory-efficient chunk-based writing</li>
|
||
</ul>
|
||
<h6 id="extra-options-3"><a class="doc-anchor" href="#extra-options-3">§</a>Extra Options</h6>
|
||
<p><a href="struct.ObjectStore.html#method.writer" title="method object_store::ObjectStore::writer"><code>Operator::writer</code></a> is a simplified version that does not include additional options.
|
||
For advanced features such as <code>chunk</code> and <code>concurrent</code>, use <a href="struct.ObjectStore.html#method.writer_with" title="method object_store::ObjectStore::writer_with"><code>Operator::writer_with</code></a> or <a href="struct.ObjectStore.html#method.writer_options" title="method object_store::ObjectStore::writer_options"><code>Operator::writer_options</code></a> instead.</p>
|
||
<h5 id="examples-14"><a class="doc-anchor" href="#examples-14">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Bytes;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>w = op.writer(<span class="string">"path/to/file"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
w.write(<span class="macro">vec!</span>[<span class="number">0</span>; <span class="number">4096</span>]).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
w.write(<span class="macro">vec!</span>[<span class="number">1</span>; <span class="number">4096</span>]).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
w.close().<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.writer_with" class="method"><h4 class="code-header">pub fn <a href="#method.writer_with" class="fn">writer_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
) -> OperatorFuture<WriteOptions, <a class="struct" href="struct.Writer.html" title="struct object_store::Writer">Writer</a>, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Writer.html" title="struct object_store::Writer">Writer</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>Create a new writer of given path with additional options.</p>
|
||
<h5 id="notes-10"><a class="doc-anchor" href="#notes-10">§</a>Notes</h5><h6 id="writer-features-1"><a class="doc-anchor" href="#writer-features-1">§</a>Writer Features</h6>
|
||
<p>The writer provides several powerful capabilities:</p>
|
||
<ul>
|
||
<li>Streaming writes for continuous data transfer</li>
|
||
<li>Automatic multipart upload handling</li>
|
||
<li>Memory-efficient chunk-based writing</li>
|
||
</ul>
|
||
<h6 id="chunk-size-handling"><a class="doc-anchor" href="#chunk-size-handling">§</a>Chunk Size Handling</h6>
|
||
<p>Storage services often have specific requirements for chunk sizes:</p>
|
||
<ul>
|
||
<li>Services like <code>s3</code> may return <code>EntityTooSmall</code> errors for undersized chunks</li>
|
||
<li>Using small chunks in cloud storage services can lead to increased costs</li>
|
||
</ul>
|
||
<p>OpenDAL automatically determines optimal chunk sizes based on the service’s
|
||
<a href="crate::types::Capability">Capability</a>. However, you can override this by explicitly
|
||
setting the <code>chunk</code> parameter.</p>
|
||
<p>Visit [<code>performance::concurrent_write</code>][crate::docs::performance::concurrent_write] for more details on concurrent writes.</p>
|
||
<h5 id="examples-15"><a class="doc-anchor" href="#examples-15">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Bytes;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>w = op
|
||
.writer_with(<span class="string">"path/to/file"</span>)
|
||
.chunk(<span class="number">4 </span>* <span class="number">1024 </span>* <span class="number">1024</span>)
|
||
.concurrent(<span class="number">8</span>)
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||
w.write(<span class="macro">vec!</span>[<span class="number">0</span>; <span class="number">4096</span>]).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
w.write(<span class="macro">vec!</span>[<span class="number">1</span>; <span class="number">4096</span>]).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
w.close().<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.writer_options" class="method"><h4 class="code-header">pub async fn <a href="#method.writer_options" class="fn">writer_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
opts: WriteOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Writer.html" title="struct object_store::Writer">Writer</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Create a new writer of given path with additional options.</p>
|
||
<h5 id="notes-11"><a class="doc-anchor" href="#notes-11">§</a>Notes</h5><h6 id="writer-features-2"><a class="doc-anchor" href="#writer-features-2">§</a>Writer Features</h6>
|
||
<p>The writer provides several powerful capabilities:</p>
|
||
<ul>
|
||
<li>Streaming writes for continuous data transfer</li>
|
||
<li>Automatic multipart upload handling</li>
|
||
<li>Memory-efficient chunk-based writing</li>
|
||
</ul>
|
||
<h6 id="chunk-size-handling-1"><a class="doc-anchor" href="#chunk-size-handling-1">§</a>Chunk Size Handling</h6>
|
||
<p>Storage services often have specific requirements for chunk sizes:</p>
|
||
<ul>
|
||
<li>Services like <code>s3</code> may return <code>EntityTooSmall</code> errors for undersized chunks</li>
|
||
<li>Using small chunks in cloud storage services can lead to increased costs</li>
|
||
</ul>
|
||
<p>OpenDAL automatically determines optimal chunk sizes based on the service’s
|
||
<a href="crate::types::Capability">Capability</a>. However, you can override this by explicitly
|
||
setting the <code>chunk</code> parameter.</p>
|
||
<p>Visit [<code>performance::concurrent_write</code>][crate::docs::performance::concurrent_write] for more details on concurrent writes.</p>
|
||
<h5 id="examples-16"><a class="doc-anchor" href="#examples-16">§</a>Examples</h5>
|
||
<p>Write data to a file in 4MiB chunk size and at 8 concurrency:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Bytes;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>w = op
|
||
.writer_with(<span class="string">"path/to/file"</span>)
|
||
.chunk(<span class="number">4 </span>* <span class="number">1024 </span>* <span class="number">1024</span>)
|
||
.concurrent(<span class="number">8</span>)
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||
w.write(<span class="macro">vec!</span>[<span class="number">0</span>; <span class="number">4096</span>]).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
w.write(<span class="macro">vec!</span>[<span class="number">1</span>; <span class="number">4096</span>]).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
w.close().<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.copy" class="method"><h4 class="code-header">pub async fn <a href="#method.copy" class="fn">copy</a>(&self, from: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, to: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Copy a file from <code>from</code> to <code>to</code>.</p>
|
||
<h5 id="notes-12"><a class="doc-anchor" href="#notes-12">§</a>Notes</h5>
|
||
<ul>
|
||
<li><code>from</code> and <code>to</code> must be a file.</li>
|
||
<li><code>to</code> will be overwritten if it exists.</li>
|
||
<li>If <code>from</code> and <code>to</code> are the same, an <code>IsSameFile</code> error will occur.</li>
|
||
<li><code>copy</code> is idempotent. For same <code>from</code> and <code>to</code> input, the result will be the same.</li>
|
||
</ul>
|
||
<h5 id="examples-17"><a class="doc-anchor" href="#examples-17">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
|
||
op.copy(<span class="string">"path/to/file"</span>, <span class="string">"path/to/file2"</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.rename" class="method"><h4 class="code-header">pub async fn <a href="#method.rename" class="fn">rename</a>(&self, from: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, to: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Rename a file from <code>from</code> to <code>to</code>.</p>
|
||
<h5 id="notes-13"><a class="doc-anchor" href="#notes-13">§</a>Notes</h5>
|
||
<ul>
|
||
<li><code>from</code> and <code>to</code> must be a file.</li>
|
||
<li><code>to</code> will be overwritten if it exists.</li>
|
||
<li>If <code>from</code> and <code>to</code> are the same, an <code>IsSameFile</code> error will occur.</li>
|
||
</ul>
|
||
<h5 id="examples-18"><a class="doc-anchor" href="#examples-18">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
|
||
op.rename(<span class="string">"path/to/file"</span>, <span class="string">"path/to/file2"</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.delete" class="method"><h4 class="code-header">pub async fn <a href="#method.delete" class="fn">delete</a>(&self, path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Delete the given path.</p>
|
||
<h5 id="notes-14"><a class="doc-anchor" href="#notes-14">§</a>Notes</h5>
|
||
<ul>
|
||
<li>Deleting a file that does not exist won’t return errors.</li>
|
||
</ul>
|
||
<h5 id="examples-19"><a class="doc-anchor" href="#examples-19">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>op.delete(<span class="string">"test"</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.delete_with" class="method"><h4 class="code-header">pub fn <a href="#method.delete_with" class="fn">delete_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
) -> OperatorFuture<DeleteOptions, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>Delete the given path with additional options.</p>
|
||
<h5 id="notes-15"><a class="doc-anchor" href="#notes-15">§</a>Notes</h5>
|
||
<ul>
|
||
<li>Deleting a file that does not exist won’t return errors.</li>
|
||
</ul>
|
||
<h5 id="options-4"><a class="doc-anchor" href="#options-4">§</a>Options</h5>
|
||
<p>Visit [<code>options::DeleteOptions</code>] for all available options.</p>
|
||
<h5 id="examples-20"><a class="doc-anchor" href="#examples-20">§</a>Examples</h5>
|
||
<p>Delete a specific version of a file:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
|
||
op.delete_with(<span class="string">"path/to/file"</span>).version(version).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.delete_options" class="method"><h4 class="code-header">pub async fn <a href="#method.delete_options" class="fn">delete_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
opts: DeleteOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Delete the given path with additional options.</p>
|
||
<h5 id="notes-16"><a class="doc-anchor" href="#notes-16">§</a>Notes</h5>
|
||
<ul>
|
||
<li>Deleting a file that does not exist won’t return errors.</li>
|
||
</ul>
|
||
<h5 id="examples-21"><a class="doc-anchor" href="#examples-21">§</a>Examples</h5>
|
||
<p>Delete a specific version of a file:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::options;
|
||
|
||
op.delete_options(<span class="string">"path/to/file"</span>, options::DeleteOptions {
|
||
version: <span class="prelude-val">Some</span>(version.to_string()),
|
||
..Default::default()
|
||
})
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.delete_iter" class="method"><h4 class="code-header">pub async fn <a href="#method.delete_iter" class="fn">delete_iter</a><I, D>(&self, iter: I) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>><div class="where">where
|
||
I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = D>,
|
||
D: IntoDeleteInput,</div></h4></section></summary><div class="docblock"><p>Delete an infallible iterator of paths.</p>
|
||
<p>Also see:</p>
|
||
<ul>
|
||
<li><a href="struct.ObjectStore.html#method.delete_try_iter" title="method object_store::ObjectStore::delete_try_iter"><code>Operator::delete_try_iter</code></a>: delete a fallible iterator of paths.</li>
|
||
<li><a href="struct.ObjectStore.html#method.delete_stream" title="method object_store::ObjectStore::delete_stream"><code>Operator::delete_stream</code></a>: delete an infallible stream of paths.</li>
|
||
<li><a href="struct.ObjectStore.html#method.delete_try_stream" title="method object_store::ObjectStore::delete_try_stream"><code>Operator::delete_try_stream</code></a>: delete a fallible stream of paths.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.delete_try_iter" class="method"><h4 class="code-header">pub async fn <a href="#method.delete_try_iter" class="fn">delete_try_iter</a><I, D>(&self, try_iter: I) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>><div class="where">where
|
||
I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><D, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>,
|
||
D: IntoDeleteInput,</div></h4></section></summary><div class="docblock"><p>Delete a fallible iterator of paths.</p>
|
||
<p>Also see:</p>
|
||
<ul>
|
||
<li><a href="struct.ObjectStore.html#method.delete_iter" title="method object_store::ObjectStore::delete_iter"><code>Operator::delete_iter</code></a>: delete an infallible iterator of paths.</li>
|
||
<li><a href="struct.ObjectStore.html#method.delete_stream" title="method object_store::ObjectStore::delete_stream"><code>Operator::delete_stream</code></a>: delete an infallible stream of paths.</li>
|
||
<li><a href="struct.ObjectStore.html#method.delete_try_stream" title="method object_store::ObjectStore::delete_try_stream"><code>Operator::delete_try_stream</code></a>: delete a fallible stream of paths.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.delete_stream" class="method"><h4 class="code-header">pub async fn <a href="#method.delete_stream" class="fn">delete_stream</a><S, D>(&self, stream: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>><div class="where">where
|
||
S: Stream<Item = D>,
|
||
D: IntoDeleteInput,</div></h4></section></summary><div class="docblock"><p>Delete an infallible stream of paths.</p>
|
||
<p>Also see:</p>
|
||
<ul>
|
||
<li><a href="struct.ObjectStore.html#method.delete_iter" title="method object_store::ObjectStore::delete_iter"><code>Operator::delete_iter</code></a>: delete an infallible iterator of paths.</li>
|
||
<li><a href="struct.ObjectStore.html#method.delete_try_iter" title="method object_store::ObjectStore::delete_try_iter"><code>Operator::delete_try_iter</code></a>: delete a fallible iterator of paths.</li>
|
||
<li><a href="struct.ObjectStore.html#method.delete_try_stream" title="method object_store::ObjectStore::delete_try_stream"><code>Operator::delete_try_stream</code></a>: delete a fallible stream of paths.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.delete_try_stream" class="method"><h4 class="code-header">pub async fn <a href="#method.delete_try_stream" class="fn">delete_try_stream</a><S, D>(&self, try_stream: S) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>><div class="where">where
|
||
S: Stream<Item = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><D, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>,
|
||
D: IntoDeleteInput,</div></h4></section></summary><div class="docblock"><p>Delete a fallible stream of paths.</p>
|
||
<p>Also see:</p>
|
||
<ul>
|
||
<li><a href="struct.ObjectStore.html#method.delete_iter" title="method object_store::ObjectStore::delete_iter"><code>Operator::delete_iter</code></a>: delete an infallible iterator of paths.</li>
|
||
<li><a href="struct.ObjectStore.html#method.delete_try_iter" title="method object_store::ObjectStore::delete_try_iter"><code>Operator::delete_try_iter</code></a>: delete a fallible iterator of paths.</li>
|
||
<li><a href="struct.ObjectStore.html#method.delete_stream" title="method object_store::ObjectStore::delete_stream"><code>Operator::delete_stream</code></a>: delete an infallible stream of paths.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.deleter" class="method"><h4 class="code-header">pub async fn <a href="#method.deleter" class="fn">deleter</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Deleter, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Create a [<code>Deleter</code>] to continuously remove content from storage.</p>
|
||
<p>It leverages batch deletion capabilities provided by storage services for efficient removal.</p>
|
||
<p>Users can have more control over the deletion process by using [<code>Deleter</code>] directly.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remove_all" class="method"><h4 class="code-header">pub async fn <a href="#method.remove_all" class="fn">remove_all</a>(&self, path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Remove the path and all nested dirs and files recursively.</p>
|
||
<h5 id="notes-17"><a class="doc-anchor" href="#notes-17">§</a>Notes</h5>
|
||
<p>If underlying services support delete in batch, we will use batch
|
||
delete instead.</p>
|
||
<h5 id="examples-22"><a class="doc-anchor" href="#examples-22">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>op.remove_all(<span class="string">"path/to/dir"</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.list" class="method"><h4 class="code-header">pub async fn <a href="#method.list" class="fn">list</a>(&self, path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="struct.Entry.html" title="struct object_store::Entry">Entry</a>>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>List entries in the parent directory that start with the specified <code>path</code>.</p>
|
||
<h5 id="notes-18"><a class="doc-anchor" href="#notes-18">§</a>Notes</h5><h6 id="recursively-list"><a class="doc-anchor" href="#recursively-list">§</a>Recursively List</h6>
|
||
<p>This function only reads the immediate children of the specified directory.
|
||
To list all entries recursively, use <code>Operator::list_with("path").recursive(true)</code> instead.</p>
|
||
<h6 id="streaming-list"><a class="doc-anchor" href="#streaming-list">§</a>Streaming List</h6>
|
||
<p>This function reads all entries in the specified directory. If the directory contains many entries, this process may take a long time and use significant memory.</p>
|
||
<p>To prevent this, consider using <a href="struct.ObjectStore.html#method.lister" title="method object_store::ObjectStore::lister"><code>Operator::lister</code></a> to stream the entries instead.</p>
|
||
<h5 id="examples-23"><a class="doc-anchor" href="#examples-23">§</a>Examples</h5>
|
||
<p>This example will list all entries under the dir <code>path/to/dir/</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::EntryMode;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">let </span><span class="kw-2">mut </span>entries = op.list(<span class="string">"path/to/dir/"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">for </span>entry <span class="kw">in </span>entries {
|
||
<span class="kw">match </span>entry.metadata().mode() {
|
||
EntryMode::FILE => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling file"</span>)
|
||
}
|
||
EntryMode::DIR => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling dir {}"</span>, entry.path())
|
||
}
|
||
EntryMode::Unknown => <span class="kw">continue</span>,
|
||
}
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.list_with" class="method"><h4 class="code-header">pub fn <a href="#method.list_with" class="fn">list_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
) -> OperatorFuture<ListOptions, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="struct.Entry.html" title="struct object_store::Entry">Entry</a>>, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="struct.Entry.html" title="struct object_store::Entry">Entry</a>>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>List entries in the parent directory that start with the specified <code>path</code> with additional options.</p>
|
||
<h5 id="notes-19"><a class="doc-anchor" href="#notes-19">§</a>Notes</h5><h6 id="streaming-list-1"><a class="doc-anchor" href="#streaming-list-1">§</a>Streaming List</h6>
|
||
<p>This function reads all entries in the specified directory. If the directory contains many entries, this process may take a long time and use significant memory.</p>
|
||
<p>To prevent this, consider using <a href="struct.ObjectStore.html#method.lister" title="method object_store::ObjectStore::lister"><code>Operator::lister</code></a> to stream the entries instead.</p>
|
||
<h5 id="options-5"><a class="doc-anchor" href="#options-5">§</a>Options</h5>
|
||
<p>Visit [<code>options::ListOptions</code>] for all available options.</p>
|
||
<h5 id="examples-24"><a class="doc-anchor" href="#examples-24">§</a>Examples</h5>
|
||
<p>This example will list all entries recursively under the prefix <code>path/to/prefix</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::EntryMode;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">let </span><span class="kw-2">mut </span>entries = op.list_with(<span class="string">"path/to/prefix"</span>).recursive(<span class="bool-val">true</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">for </span>entry <span class="kw">in </span>entries {
|
||
<span class="kw">match </span>entry.metadata().mode() {
|
||
EntryMode::FILE => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling file"</span>)
|
||
}
|
||
EntryMode::DIR => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling dir like start a new list via meta.path()"</span>)
|
||
}
|
||
EntryMode::Unknown => <span class="kw">continue</span>,
|
||
}
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.list_options" class="method"><h4 class="code-header">pub async fn <a href="#method.list_options" class="fn">list_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
opts: ListOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="struct.Entry.html" title="struct object_store::Entry">Entry</a>>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>List entries in the parent directory that start with the specified <code>path</code> with additional options.</p>
|
||
<h5 id="notes-20"><a class="doc-anchor" href="#notes-20">§</a>Notes</h5><h6 id="streaming-list-2"><a class="doc-anchor" href="#streaming-list-2">§</a>Streaming List</h6>
|
||
<p>This function reads all entries in the specified directory. If the directory contains many entries, this process may take a long time and use significant memory.</p>
|
||
<p>To prevent this, consider using <a href="struct.ObjectStore.html#method.lister" title="method object_store::ObjectStore::lister"><code>Operator::lister</code></a> to stream the entries instead.</p>
|
||
<h5 id="options-6"><a class="doc-anchor" href="#options-6">§</a>Options</h5>
|
||
<p>Visit [<code>options::ListOptions</code>] for all available options.</p>
|
||
<h5 id="examples-25"><a class="doc-anchor" href="#examples-25">§</a>Examples</h5>
|
||
<p>This example will list all entries recursively under the prefix <code>path/to/prefix</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::options;
|
||
<span class="kw">use </span>opendal::EntryMode;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">let </span><span class="kw-2">mut </span>entries = op
|
||
.list_options(<span class="string">"path/to/prefix"</span>, options::ListOptions {
|
||
recursive: <span class="bool-val">true</span>,
|
||
..Default::default()
|
||
})
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">for </span>entry <span class="kw">in </span>entries {
|
||
<span class="kw">match </span>entry.metadata().mode() {
|
||
EntryMode::FILE => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling file"</span>)
|
||
}
|
||
EntryMode::DIR => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling dir like start a new list via meta.path()"</span>)
|
||
}
|
||
EntryMode::Unknown => <span class="kw">continue</span>,
|
||
}
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.lister" class="method"><h4 class="code-header">pub async fn <a href="#method.lister" class="fn">lister</a>(&self, path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Lister.html" title="struct object_store::Lister">Lister</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Create a new lister to list entries that starts with given <code>path</code> in parent dir.</p>
|
||
<h5 id="notes-21"><a class="doc-anchor" href="#notes-21">§</a>Notes</h5><h6 id="recursively-list-1"><a class="doc-anchor" href="#recursively-list-1">§</a>Recursively list</h6>
|
||
<p>This function only reads the immediate children of the specified directory.
|
||
To retrieve all entries recursively, use <a href="struct.ObjectStore.html#method.lister_with" title="method object_store::ObjectStore::lister_with"><code>Operator::lister_with</code></a> with <code>recursive(true)</code> instead.</p>
|
||
<h5 id="examples-26"><a class="doc-anchor" href="#examples-26">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::TryStreamExt;
|
||
<span class="kw">use </span>opendal::EntryMode;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">let </span><span class="kw-2">mut </span>ds = op.lister(<span class="string">"path/to/dir/"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">while let </span><span class="prelude-val">Some</span>(<span class="kw-2">mut </span>de) = ds.try_next().<span class="kw">await</span><span class="question-mark">? </span>{
|
||
<span class="kw">match </span>de.metadata().mode() {
|
||
EntryMode::FILE => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling file"</span>)
|
||
}
|
||
EntryMode::DIR => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling dir like start a new list via meta.path()"</span>)
|
||
}
|
||
EntryMode::Unknown => <span class="kw">continue</span>,
|
||
}
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.lister_with" class="method"><h4 class="code-header">pub fn <a href="#method.lister_with" class="fn">lister_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
) -> OperatorFuture<ListOptions, <a class="struct" href="struct.Lister.html" title="struct object_store::Lister">Lister</a>, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Lister.html" title="struct object_store::Lister">Lister</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>Create a new lister to list entries that starts with given <code>path</code> in parent dir with additional options.</p>
|
||
<h5 id="options-7"><a class="doc-anchor" href="#options-7">§</a>Options</h5>
|
||
<p>Visit [<code>options::ListOptions</code>] for all available options.</p>
|
||
<h5 id="examples-27"><a class="doc-anchor" href="#examples-27">§</a>Examples</h5><h6 id="list-all-files-recursively"><a class="doc-anchor" href="#list-all-files-recursively">§</a>List all files recursively</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::TryStreamExt;
|
||
<span class="kw">use </span>opendal::EntryMode;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">let </span><span class="kw-2">mut </span>lister = op.lister_with(<span class="string">"path/to/dir/"</span>).recursive(<span class="bool-val">true</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">while let </span><span class="prelude-val">Some</span>(<span class="kw-2">mut </span>entry) = lister.try_next().<span class="kw">await</span><span class="question-mark">? </span>{
|
||
<span class="kw">match </span>entry.metadata().mode() {
|
||
EntryMode::FILE => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling file {}"</span>, entry.path())
|
||
}
|
||
EntryMode::DIR => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling dir {}"</span>, entry.path())
|
||
}
|
||
EntryMode::Unknown => <span class="kw">continue</span>,
|
||
}
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.lister_options" class="method"><h4 class="code-header">pub async fn <a href="#method.lister_options" class="fn">lister_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
opts: ListOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Lister.html" title="struct object_store::Lister">Lister</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Create a new lister to list entries that starts with given <code>path</code> in parent dir with additional options.</p>
|
||
<h5 id="examples-28"><a class="doc-anchor" href="#examples-28">§</a>Examples</h5><h6 id="list-all-files-recursively-1"><a class="doc-anchor" href="#list-all-files-recursively-1">§</a>List all files recursively</h6>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::TryStreamExt;
|
||
<span class="kw">use </span>opendal::options;
|
||
<span class="kw">use </span>opendal::EntryMode;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">let </span><span class="kw-2">mut </span>lister = op
|
||
.lister_options(<span class="string">"path/to/dir/"</span>, options::ListOptions {
|
||
recursive: <span class="bool-val">true</span>,
|
||
..Default::default()
|
||
})
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">while let </span><span class="prelude-val">Some</span>(<span class="kw-2">mut </span>entry) = lister.try_next().<span class="kw">await</span><span class="question-mark">? </span>{
|
||
<span class="kw">match </span>entry.metadata().mode() {
|
||
EntryMode::FILE => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling file {}"</span>, entry.path())
|
||
}
|
||
EntryMode::DIR => {
|
||
<span class="macro">println!</span>(<span class="string">"Handling dir {}"</span>, entry.path())
|
||
}
|
||
EntryMode::Unknown => <span class="kw">continue</span>,
|
||
}
|
||
}</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Operator-2" class="impl"><a href="#impl-Operator-2" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3><div class="docblock"><p>Operator presign API.</p>
|
||
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.presign_stat" class="method"><h4 class="code-header">pub async fn <a href="#method.presign_stat" class="fn">presign_stat</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Presign an operation for stat(head).</p>
|
||
<h5 id="example-1"><a class="doc-anchor" href="#example-1">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>futures::io;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">use </span>std::time::Duration;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>signed_req = op.presign_stat(<span class="string">"test"</span>,Duration::from_secs(<span class="number">3600</span>)).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">let </span>req = http::Request::builder()
|
||
.method(signed_req.method())
|
||
.uri(signed_req.uri())
|
||
.body(())<span class="question-mark">?</span>;
|
||
</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.presign_stat_with" class="method"><h4 class="code-header">pub fn <a href="#method.presign_stat_with" class="fn">presign_stat_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
) -> OperatorFuture<(StatOptions, <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>), PresignedRequest, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>Presign an operation for stat(head).</p>
|
||
<h5 id="example-2"><a class="doc-anchor" href="#example-2">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>futures::io;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">use </span>std::time::Duration;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>signed_req = op.presign_stat_with(<span class="string">"test"</span>,Duration::from_secs(<span class="number">3600</span>)).override_content_disposition(<span class="string">"attachment; filename=\"othertext.txt\""</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.presign_stat_options" class="method"><h4 class="code-header">pub async fn <a href="#method.presign_stat_options" class="fn">presign_stat_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
opts: StatOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Presign an operation for stat(head) with additional options.</p>
|
||
<h5 id="options-8"><a class="doc-anchor" href="#options-8">§</a>Options</h5>
|
||
<p>Visit [<code>options::StatOptions</code>] for all available options.</p>
|
||
<h5 id="example-3"><a class="doc-anchor" href="#example-3">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">use </span>opendal::options;
|
||
<span class="kw">use </span>std::time::Duration;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>signed_req = op.presign_stat_options(
|
||
<span class="string">"test"</span>,
|
||
Duration::from_secs(<span class="number">3600</span>),
|
||
options::StatOptions {
|
||
if_match: <span class="prelude-val">Some</span>(<span class="string">"<etag>"</span>.to_string()),
|
||
..Default::default()
|
||
}
|
||
).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">let </span>req = http::Request::builder()
|
||
.method(signed_req.method())
|
||
.uri(signed_req.uri())
|
||
.body(())<span class="question-mark">?</span>;
|
||
</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.presign_read" class="method"><h4 class="code-header">pub async fn <a href="#method.presign_read" class="fn">presign_read</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Presign an operation for read.</p>
|
||
<h5 id="notes-22"><a class="doc-anchor" href="#notes-22">§</a>Notes</h5><h6 id="extra-options-4"><a class="doc-anchor" href="#extra-options-4">§</a>Extra Options</h6>
|
||
<p><code>presign_read</code> is a wrapper of <a href="struct.ObjectStore.html#method.presign_read_with" title="method object_store::ObjectStore::presign_read_with"><code>Self::presign_read_with</code></a> without any options. To use
|
||
extra options like <code>override_content_disposition</code>, please use <a href="struct.ObjectStore.html#method.presign_read_with" title="method object_store::ObjectStore::presign_read_with"><code>Self::presign_read_with</code></a> or
|
||
<a href="struct.ObjectStore.html#method.presign_read_options" title="method object_store::ObjectStore::presign_read_options">`Self::presign_read_options</a> instead.</p>
|
||
<h5 id="example-4"><a class="doc-anchor" href="#example-4">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>futures::io;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">use </span>std::time::Duration;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>signed_req = op.presign_read(<span class="string">"test.txt"</span>, Duration::from_secs(<span class="number">3600</span>)).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div>
|
||
<ul>
|
||
<li><code>signed_req.method()</code>: <code>GET</code></li>
|
||
<li><code>signed_req.uri()</code>: <code>https://s3.amazonaws.com/examplebucket/test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=access_key_id/20130721/us-east-1/s3/aws4_request&X-Amz-Date=20130721T201207Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=<signature-value></code></li>
|
||
<li><code>signed_req.headers()</code>: <code>{ "host": "s3.amazonaws.com" }</code></li>
|
||
</ul>
|
||
<p>We can download this file via <code>curl</code> or other tools without credentials:</p>
|
||
<div class="example-wrap"><pre class="language-shell"><code>curl "https://s3.amazonaws.com/examplebucket/test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=access_key_id/20130721/us-east-1/s3/aws4_request&X-Amz-Date=20130721T201207Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=<signature-value>" -O /tmp/test.txt</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.presign_read_with" class="method"><h4 class="code-header">pub fn <a href="#method.presign_read_with" class="fn">presign_read_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
) -> OperatorFuture<(ReadOptions, <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>), PresignedRequest, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>Presign an operation for read with extra options.</p>
|
||
<h5 id="options-9"><a class="doc-anchor" href="#options-9">§</a>Options</h5>
|
||
<p>Visit [<code>options::ReadOptions</code>] for all available options.</p>
|
||
<h5 id="example-5"><a class="doc-anchor" href="#example-5">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::time::Duration;
|
||
|
||
<span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>futures::io;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>signed_req = op
|
||
.presign_read_with(<span class="string">"test.txt"</span>, Duration::from_secs(<span class="number">3600</span>))
|
||
.override_content_type(<span class="string">"text/plain"</span>)
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.presign_read_options" class="method"><h4 class="code-header">pub async fn <a href="#method.presign_read_options" class="fn">presign_read_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
opts: ReadOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Presign an operation for read with additional options.</p>
|
||
<h5 id="options-10"><a class="doc-anchor" href="#options-10">§</a>Options</h5>
|
||
<p>Visit [<code>options::ReadOptions</code>] for all available options.</p>
|
||
<h5 id="example-6"><a class="doc-anchor" href="#example-6">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">use </span>opendal::options;
|
||
<span class="kw">use </span>std::time::Duration;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>signed_req = op.presign_read_options(
|
||
<span class="string">"file"</span>,
|
||
Duration::from_secs(<span class="number">3600</span>),
|
||
options::ReadOptions {
|
||
override_content_disposition: <span class="prelude-val">Some</span>(<span class="string">"attachment; filename=\"othertext.txt\""</span>.to_string()),
|
||
..Default::default()
|
||
}
|
||
).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">let </span>req = http::Request::builder()
|
||
.method(signed_req.method())
|
||
.uri(signed_req.uri())
|
||
.body(())<span class="question-mark">?</span>;
|
||
</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.presign_write" class="method"><h4 class="code-header">pub async fn <a href="#method.presign_write" class="fn">presign_write</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Presign an operation for write.</p>
|
||
<h5 id="notes-23"><a class="doc-anchor" href="#notes-23">§</a>Notes</h5><h6 id="extra-options-5"><a class="doc-anchor" href="#extra-options-5">§</a>Extra Options</h6>
|
||
<p><code>presign_write</code> is a wrapper of <a href="struct.ObjectStore.html#method.presign_write_with" title="method object_store::ObjectStore::presign_write_with"><code>Self::presign_write_with</code></a> without any options. To use
|
||
extra options like <code>content_type</code>, please use <a href="struct.ObjectStore.html#method.presign_write_with" title="method object_store::ObjectStore::presign_write_with"><code>Self::presign_write_with</code></a> or
|
||
<a href="struct.ObjectStore.html#method.presign_write_options" title="method object_store::ObjectStore::presign_write_options"><code>Self::presign_write_options</code></a> instead.</p>
|
||
<h5 id="example-7"><a class="doc-anchor" href="#example-7">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::time::Duration;
|
||
|
||
<span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>signed_req = op
|
||
.presign_write(<span class="string">"test.txt"</span>, Duration::from_secs(<span class="number">3600</span>))
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div>
|
||
<ul>
|
||
<li><code>signed_req.method()</code>: <code>PUT</code></li>
|
||
<li><code>signed_req.uri()</code>: <code>https://s3.amazonaws.com/examplebucket/test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=access_key_id/20130721/us-east-1/s3/aws4_request&X-Amz-Date=20130721T201207Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=<signature-value></code></li>
|
||
<li><code>signed_req.headers()</code>: <code>{ "host": "s3.amazonaws.com" }</code></li>
|
||
</ul>
|
||
<p>We can upload file as this file via <code>curl</code> or other tools without credential:</p>
|
||
<div class="example-wrap"><pre class="language-shell"><code>curl -X PUT "https://s3.amazonaws.com/examplebucket/test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=access_key_id/20130721/us-east-1/s3/aws4_request&X-Amz-Date=20130721T201207Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=<signature-value>" -d "Hello, World!"</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.presign_write_with" class="method"><h4 class="code-header">pub fn <a href="#method.presign_write_with" class="fn">presign_write_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
) -> OperatorFuture<(WriteOptions, <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>), PresignedRequest, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>Presign an operation for write with extra options.</p>
|
||
<h5 id="options-11"><a class="doc-anchor" href="#options-11">§</a>Options</h5>
|
||
<p>Visit [<code>options::WriteOptions</code>] for all available options.</p>
|
||
<h5 id="example-8"><a class="doc-anchor" href="#example-8">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::time::Duration;
|
||
|
||
<span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>signed_req = op
|
||
.presign_write_with(<span class="string">"test"</span>, Duration::from_secs(<span class="number">3600</span>))
|
||
.cache_control(<span class="string">"no-store"</span>)
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">let </span>req = http::Request::builder()
|
||
.method(signed_req.method())
|
||
.uri(signed_req.uri())
|
||
.body(())<span class="question-mark">?</span>;
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.presign_write_options" class="method"><h4 class="code-header">pub async fn <a href="#method.presign_write_options" class="fn">presign_write_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
opts: WriteOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Presign an operation for write with additional options.</p>
|
||
<h5 id="options-12"><a class="doc-anchor" href="#options-12">§</a>Options</h5>
|
||
<p>Check [<code>options::WriteOptions</code>] for all available options.</p>
|
||
<h5 id="example-9"><a class="doc-anchor" href="#example-9">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">use </span>opendal::options;
|
||
<span class="kw">use </span>std::time::Duration;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>signed_req = op.presign_write_options(
|
||
<span class="string">"file"</span>,
|
||
Duration::from_secs(<span class="number">3600</span>),
|
||
options::WriteOptions {
|
||
content_type: <span class="prelude-val">Some</span>(<span class="string">"application/json"</span>.to_string()),
|
||
cache_control: <span class="prelude-val">Some</span>(<span class="string">"max-age=3600"</span>.to_string()),
|
||
if_not_exists: <span class="bool-val">true</span>,
|
||
..Default::default()
|
||
}
|
||
).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">let </span>req = http::Request::builder()
|
||
.method(signed_req.method())
|
||
.uri(signed_req.uri())
|
||
.body(())<span class="question-mark">?</span>;
|
||
</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.presign_delete" class="method"><h4 class="code-header">pub async fn <a href="#method.presign_delete" class="fn">presign_delete</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Presign an operation for delete.</p>
|
||
<h5 id="notes-24"><a class="doc-anchor" href="#notes-24">§</a>Notes</h5><h6 id="extra-options-6"><a class="doc-anchor" href="#extra-options-6">§</a>Extra Options</h6>
|
||
<p><code>presign_delete</code> is a wrapper of <a href="struct.ObjectStore.html#method.presign_delete_with" title="method object_store::ObjectStore::presign_delete_with"><code>Self::presign_delete_with</code></a> without any options.</p>
|
||
<h5 id="example-10"><a class="doc-anchor" href="#example-10">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::time::Duration;
|
||
|
||
<span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>signed_req = op
|
||
.presign_delete(<span class="string">"test.txt"</span>, Duration::from_secs(<span class="number">3600</span>))
|
||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div>
|
||
<ul>
|
||
<li><code>signed_req.method()</code>: <code>DELETE</code></li>
|
||
<li><code>signed_req.uri()</code>: <code>https://s3.amazonaws.com/examplebucket/test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=access_key_id/20130721/us-east-1/s3/aws4_request&X-Amz-Date=20130721T201207Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=<signature-value></code></li>
|
||
<li><code>signed_req.headers()</code>: <code>{ "host": "s3.amazonaws.com" }</code></li>
|
||
</ul>
|
||
<p>We can delete file as this file via <code>curl</code> or other tools without credential:</p>
|
||
<div class="example-wrap"><pre class="language-shell"><code>curl -X DELETE "https://s3.amazonaws.com/examplebucket/test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=access_key_id/20130721/us-east-1/s3/aws4_request&X-Amz-Date=20130721T201207Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=<signature-value>"</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.presign_delete_with" class="method"><h4 class="code-header">pub fn <a href="#method.presign_delete_with" class="fn">presign_delete_with</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
) -> OperatorFuture<(DeleteOptions, <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>), PresignedRequest, impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>>>></h4></section></summary><div class="docblock"><p>Presign an operation for delete without extra options.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.presign_delete_options" class="method"><h4 class="code-header">pub async fn <a href="#method.presign_delete_options" class="fn">presign_delete_options</a>(
|
||
&self,
|
||
path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||
expire: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||
opts: DeleteOptions,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><PresignedRequest, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Presign an operation for delete with additional options.</p>
|
||
<h5 id="options-13"><a class="doc-anchor" href="#options-13">§</a>Options</h5>
|
||
<p>Visit [<code>options::DeleteOptions</code>] for all available options.</p>
|
||
<h5 id="example-11"><a class="doc-anchor" href="#example-11">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>anyhow::Result;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">use </span>opendal::options;
|
||
<span class="kw">use </span>std::time::Duration;
|
||
|
||
<span class="kw">async fn </span>test(op: Operator) -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>signed_req = op.presign_delete_options(
|
||
<span class="string">"path/to/file"</span>,
|
||
Duration::from_secs(<span class="number">3600</span>),
|
||
options::DeleteOptions {
|
||
..Default::default()
|
||
}
|
||
).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">let </span>req = http::Request::builder()
|
||
.method(signed_req.method())
|
||
.uri(signed_req.uri())
|
||
.body(())<span class="question-mark">?</span>;
|
||
</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Operator-3" class="impl"><a href="#impl-Operator-3" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3><div class="docblock"><h4 id="operator-build-api"><a class="doc-anchor" href="#operator-build-api">§</a>Operator build API</h4>
|
||
<p>Operator should be built via [<code>OperatorBuilder</code>]. We recommend to use <a href="struct.ObjectStore.html#method.new" title="associated function object_store::ObjectStore::new"><code>Operator::new</code></a> to get started:</p>
|
||
</div></section></summary><div class="docblock">
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::services::Fs;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">async fn </span>test() -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="comment">// Create fs backend builder.
|
||
</span><span class="kw">let </span>builder = Fs::default().root(<span class="string">"/tmp"</span>);
|
||
|
||
<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><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a><B>(ab: B) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><OperatorBuilder<impl <a class="trait" href="trait.Access.html" title="trait object_store::Access">Access</a>>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>><div class="where">where
|
||
B: <a class="trait" href="trait.ObjectStoreBuilder.html" title="trait object_store::ObjectStoreBuilder">Builder</a>,</div></h4></section></summary><div class="docblock"><p>Create a new operator with input builder.</p>
|
||
<p>OpenDAL will call <code>builder.build()</code> internally, so we don’t need
|
||
to import <code>opendal::Builder</code> trait.</p>
|
||
<h5 id="examples-29"><a class="doc-anchor" href="#examples-29">§</a>Examples</h5>
|
||
<p>Read more backend init examples in <a href="https://github.com/apache/opendal/tree/main/examples">examples</a>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::services::Fs;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">async fn </span>test() -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="comment">// Create fs backend builder.
|
||
</span><span class="kw">let </span>builder = Fs::default().root(<span class="string">"/tmp"</span>);
|
||
|
||
<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><details class="toggle method-toggle" open><summary><section id="method.from_config" class="method"><h4 class="code-header">pub fn <a href="#method.from_config" class="fn">from_config</a><C>(cfg: C) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><OperatorBuilder<impl <a class="trait" href="trait.Access.html" title="trait object_store::Access">Access</a>>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>><div class="where">where
|
||
C: Configurator,</div></h4></section></summary><div class="docblock"><p>Create a new operator from given config.</p>
|
||
<h5 id="examples-30"><a class="doc-anchor" href="#examples-30">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">use </span>opendal::services::MemoryConfig;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">async fn </span>test() -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>cfg = MemoryConfig::default();
|
||
|
||
<span class="comment">// Build an `Operator` to start operating the storage.
|
||
</span><span class="kw">let </span>op: Operator = Operator::from_config(cfg)<span class="question-mark">?</span>.finish();
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.from_iter" class="method"><h4 class="code-header">pub fn <a href="#method.from_iter" class="fn">from_iter</a><B>(
|
||
iter: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = (<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>)>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><OperatorBuilder<impl <a class="trait" href="trait.Access.html" title="trait object_store::Access">Access</a>>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>><div class="where">where
|
||
B: <a class="trait" href="trait.ObjectStoreBuilder.html" title="trait object_store::ObjectStoreBuilder">Builder</a>,</div></h4></section></summary><div class="docblock"><p>Create a new operator from given iterator in static dispatch.</p>
|
||
<h5 id="notes-25"><a class="doc-anchor" href="#notes-25">§</a>Notes</h5>
|
||
<p><code>from_iter</code> generates a <code>OperatorBuilder</code> which allows adding layer in zero-cost way.</p>
|
||
<h5 id="examples-31"><a class="doc-anchor" href="#examples-31">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">use </span>opendal::services::Fs;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">async fn </span>test() -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>map = HashMap::from([
|
||
<span class="comment">// Set the root for fs, all operations will happen under this root.
|
||
//
|
||
// NOTE: the root must be absolute path.
|
||
</span>(<span class="string">"root"</span>.to_string(), <span class="string">"/tmp"</span>.to_string()),
|
||
]);
|
||
|
||
<span class="comment">// Build an `Operator` to start operating the storage.
|
||
</span><span class="kw">let </span>op: Operator = Operator::from_iter::<Fs>(map)<span class="question-mark">?</span>.finish();
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.via_iter" class="method"><h4 class="code-header">pub fn <a href="#method.via_iter" class="fn">via_iter</a>(
|
||
scheme: <a class="enum" href="enum.Scheme.html" title="enum object_store::Scheme">Scheme</a>,
|
||
iter: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = (<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>)>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section></summary><div class="docblock"><p>Create a new operator via given scheme and iterator of config value in dynamic dispatch.</p>
|
||
<h5 id="notes-26"><a class="doc-anchor" href="#notes-26">§</a>Notes</h5>
|
||
<p><code>via_iter</code> generates a <code>Operator</code> which allows building operator without generic type.</p>
|
||
<h5 id="examples-32"><a class="doc-anchor" href="#examples-32">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">use </span>opendal::Scheme;
|
||
<span class="kw">async fn </span>test() -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>map = [
|
||
<span class="comment">// Set the root for fs, all operations will happen under this root.
|
||
//
|
||
// NOTE: the root must be absolute path.
|
||
</span>(<span class="string">"root"</span>.to_string(), <span class="string">"/tmp"</span>.to_string()),
|
||
];
|
||
|
||
<span class="comment">// Build an `Operator` to start operating the storage.
|
||
</span><span class="kw">let </span>op: Operator = Operator::via_iter(Scheme::Fs, map)<span class="question-mark">?</span>;
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.from_map" class="method"><h4 class="code-header">pub fn <a href="#method.from_map" class="fn">from_map</a><B>(
|
||
map: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><OperatorBuilder<impl <a class="trait" href="trait.Access.html" title="trait object_store::Access">Access</a>>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>><div class="where">where
|
||
B: <a class="trait" href="trait.ObjectStoreBuilder.html" title="trait object_store::ObjectStoreBuilder">Builder</a>,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use from_iter instead</span></div></span></summary><div class="docblock"><p>Create a new operator from given map.</p>
|
||
<h5 id="notes-27"><a class="doc-anchor" href="#notes-27">§</a>Notes</h5>
|
||
<p>from_map is using static dispatch layers which is zero cost. via_map is
|
||
using dynamic dispatch layers which has a bit runtime overhead with an
|
||
extra vtable lookup and unable to inline. But from_map requires generic
|
||
type parameter which is not always easy to be used.</p>
|
||
<h5 id="examples-33"><a class="doc-anchor" href="#examples-33">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">use </span>opendal::services::Fs;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">async fn </span>test() -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>map = HashMap::from([
|
||
<span class="comment">// Set the root for fs, all operations will happen under this root.
|
||
//
|
||
// NOTE: the root must be absolute path.
|
||
</span>(<span class="string">"root"</span>.to_string(), <span class="string">"/tmp"</span>.to_string()),
|
||
]);
|
||
|
||
<span class="comment">// Build an `Operator` to start operating the storage.
|
||
</span><span class="kw">let </span>op: Operator = Operator::from_map::<Fs>(map)<span class="question-mark">?</span>.finish();
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.via_map" class="method"><h4 class="code-header">pub fn <a href="#method.via_map" class="fn">via_map</a>(
|
||
scheme: <a class="enum" href="enum.Scheme.html" title="enum object_store::Scheme">Scheme</a>,
|
||
map: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a>, <a class="struct" href="struct.Error.html" title="struct object_store::Error">Error</a>></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated: use via_iter instead</span></div></span></summary><div class="docblock"><p>Create a new operator from given scheme and map.</p>
|
||
<h5 id="notes-28"><a class="doc-anchor" href="#notes-28">§</a>Notes</h5>
|
||
<p>from_map is using static dispatch layers which is zero cost. via_map is
|
||
using dynamic dispatch layers which has a bit runtime overhead with an
|
||
extra vtable lookup and unable to inline. But from_map requires generic
|
||
type parameter which is not always easy to be used.</p>
|
||
<h5 id="examples-34"><a class="doc-anchor" href="#examples-34">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">use </span>opendal::Operator;
|
||
<span class="kw">use </span>opendal::Scheme;
|
||
<span class="kw">async fn </span>test() -> <span class="prelude-ty">Result</span><()> {
|
||
<span class="kw">let </span>map = HashMap::from([
|
||
<span class="comment">// Set the root for fs, all operations will happen under this root.
|
||
//
|
||
// NOTE: the root must be absolute path.
|
||
</span>(<span class="string">"root"</span>.to_string(), <span class="string">"/tmp"</span>.to_string()),
|
||
]);
|
||
|
||
<span class="comment">// Build an `Operator` to start operating the storage.
|
||
</span><span class="kw">let </span>op: Operator = Operator::via_map(Scheme::Fs, map)<span class="question-mark">?</span>;
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.layer" class="method"><h4 class="code-header">pub fn <a href="#method.layer" class="fn">layer</a><L>(self, layer: L) -> <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a><div class="where">where
|
||
L: <a class="trait" href="layers/mock/trait.Layer.html" title="trait object_store::layers::mock::Layer">Layer</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><dyn AccessDyn>>,</div></h4></section></summary><div class="docblock"><p>Create a new layer with dynamic dispatch.</p>
|
||
<p>Please note that <code>Layer</code> can modify internal contexts such as <code>HttpClient</code>
|
||
and <code>Runtime</code> for the operator. Therefore, it is recommended to add layers
|
||
before interacting with the storage. Adding or duplicating layers after
|
||
accessing the storage may result in unexpected behavior.</p>
|
||
<h5 id="notes-29"><a class="doc-anchor" href="#notes-29">§</a>Notes</h5>
|
||
<p><code>OperatorBuilder::layer()</code> is using static dispatch which is zero
|
||
cost. <code>Operator::layer()</code> is using dynamic dispatch which has a
|
||
bit runtime overhead with an extra vtable lookup and unable to
|
||
inline.</p>
|
||
<p>It’s always recommended to use <code>OperatorBuilder::layer()</code> instead.</p>
|
||
<h5 id="examples-35"><a class="doc-anchor" href="#examples-35">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>opendal::layers::LoggingLayer;
|
||
<span class="kw">use </span>opendal::services::Fs;
|
||
<span class="kw">use </span>opendal::Operator;
|
||
|
||
<span class="kw">let </span>op = Operator::new(Fs::default())<span class="question-mark">?</span>.finish();
|
||
<span class="kw">let </span>op = op.layer(LoggingLayer::default());
|
||
<span class="comment">// All operations will go through the new_layer
|
||
</span><span class="kw">let _ </span>= op.read(<span class="string">"test_file"</span>).<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-Operator" class="impl"><a href="#impl-Clone-for-Operator" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&self) -> <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h4></section></summary><div class='docblock'>Returns a duplicate of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#245-247">Source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&mut self, source: &Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Operator" class="impl"><a href="#impl-Debug-for-Operator" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-Operator" class="impl"><a href="#impl-Freeze-for-Operator" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3></section><section id="impl-RefUnwindSafe-for-Operator" class="impl"><a href="#impl-RefUnwindSafe-for-Operator" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3></section><section id="impl-Send-for-Operator" class="impl"><a href="#impl-Send-for-Operator" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3></section><section id="impl-Sync-for-Operator" class="impl"><a href="#impl-Sync-for-Operator" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3></section><section id="impl-Unpin-for-Operator" class="impl"><a href="#impl-Unpin-for-Operator" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3></section><section id="impl-UnwindSafe-for-Operator" class="impl"><a href="#impl-UnwindSafe-for-Operator" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.ObjectStore.html" title="struct object_store::ObjectStore">Operator</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#212">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#222">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-CloneToUninit-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#515">Source</a><a href="#impl-CloneToUninit-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.CloneToUninit.html" title="trait core::clone::CloneToUninit">CloneToUninit</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone_to_uninit" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#517">Source</a><a href="#method.clone_to_uninit" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit" class="fn">clone_to_uninit</a>(&self, dest: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>)</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>clone_to_uninit</code>)</span></div></span><div class='docblock'>Performs copy-assignment from <code>self</code> to <code>dest</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Conv-for-T" class="impl"><a href="#impl-Conv-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Conv for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.conv" class="method trait-impl"><a href="#method.conv" class="anchor">§</a><h4 class="code-header">fn <a class="fn">conv</a><T>(self) -> T<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h4></section></summary><div class='docblock'>Converts <code>self</code> into <code>T</code> using <code>Into<T></code>. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FmtForward-for-T" class="impl"><a href="#impl-FmtForward-for-T" class="anchor">§</a><h3 class="code-header">impl<T> FmtForward for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt_binary" class="method trait-impl"><a href="#method.fmt_binary" class="anchor">§</a><h4 class="code-header">fn <a class="fn">fmt_binary</a>(self) -> FmtBinary<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Binary.html" title="trait core::fmt::Binary">Binary</a>,</div></h4></section></summary><div class='docblock'>Causes <code>self</code> to use its <code>Binary</code> implementation when <code>Debug</code>-formatted.</div></details><details class="toggle method-toggle" open><summary><section id="method.fmt_display" class="method trait-impl"><a href="#method.fmt_display" class="anchor">§</a><h4 class="code-header">fn <a class="fn">fmt_display</a>(self) -> FmtDisplay<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,</div></h4></section></summary><div class='docblock'>Causes <code>self</code> to use its <code>Display</code> implementation when
|
||
<code>Debug</code>-formatted.</div></details><details class="toggle method-toggle" open><summary><section id="method.fmt_lower_exp" class="method trait-impl"><a href="#method.fmt_lower_exp" class="anchor">§</a><h4 class="code-header">fn <a class="fn">fmt_lower_exp</a>(self) -> FmtLowerExp<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.LowerExp.html" title="trait core::fmt::LowerExp">LowerExp</a>,</div></h4></section></summary><div class='docblock'>Causes <code>self</code> to use its <code>LowerExp</code> implementation when
|
||
<code>Debug</code>-formatted.</div></details><details class="toggle method-toggle" open><summary><section id="method.fmt_lower_hex" class="method trait-impl"><a href="#method.fmt_lower_hex" class="anchor">§</a><h4 class="code-header">fn <a class="fn">fmt_lower_hex</a>(self) -> FmtLowerHex<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.LowerHex.html" title="trait core::fmt::LowerHex">LowerHex</a>,</div></h4></section></summary><div class='docblock'>Causes <code>self</code> to use its <code>LowerHex</code> implementation when
|
||
<code>Debug</code>-formatted.</div></details><details class="toggle method-toggle" open><summary><section id="method.fmt_octal" class="method trait-impl"><a href="#method.fmt_octal" class="anchor">§</a><h4 class="code-header">fn <a class="fn">fmt_octal</a>(self) -> FmtOctal<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Octal.html" title="trait core::fmt::Octal">Octal</a>,</div></h4></section></summary><div class='docblock'>Causes <code>self</code> to use its <code>Octal</code> implementation when <code>Debug</code>-formatted.</div></details><details class="toggle method-toggle" open><summary><section id="method.fmt_pointer" class="method trait-impl"><a href="#method.fmt_pointer" class="anchor">§</a><h4 class="code-header">fn <a class="fn">fmt_pointer</a>(self) -> FmtPointer<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Pointer.html" title="trait core::fmt::Pointer">Pointer</a>,</div></h4></section></summary><div class='docblock'>Causes <code>self</code> to use its <code>Pointer</code> implementation when
|
||
<code>Debug</code>-formatted.</div></details><details class="toggle method-toggle" open><summary><section id="method.fmt_upper_exp" class="method trait-impl"><a href="#method.fmt_upper_exp" class="anchor">§</a><h4 class="code-header">fn <a class="fn">fmt_upper_exp</a>(self) -> FmtUpperExp<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.UpperExp.html" title="trait core::fmt::UpperExp">UpperExp</a>,</div></h4></section></summary><div class='docblock'>Causes <code>self</code> to use its <code>UpperExp</code> implementation when
|
||
<code>Debug</code>-formatted.</div></details><details class="toggle method-toggle" open><summary><section id="method.fmt_upper_hex" class="method trait-impl"><a href="#method.fmt_upper_hex" class="anchor">§</a><h4 class="code-header">fn <a class="fn">fmt_upper_hex</a>(self) -> FmtUpperHex<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.UpperHex.html" title="trait core::fmt::UpperHex">UpperHex</a>,</div></h4></section></summary><div class='docblock'>Causes <code>self</code> to use its <code>UpperHex</code> implementation when
|
||
<code>Debug</code>-formatted.</div></details><details class="toggle method-toggle" open><summary><section id="method.fmt_list" class="method trait-impl"><a href="#method.fmt_list" class="anchor">§</a><h4 class="code-header">fn <a class="fn">fmt_list</a>(self) -> FmtList<Self><div class="where">where
|
||
&'a Self: for<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,</div></h4></section></summary><div class='docblock'>Formats each item in a sequence. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#785">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#788">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FromRef%3CT%3E-for-T" class="impl"><a href="#impl-FromRef%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> FromRef<T> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_ref" class="method trait-impl"><a href="#method.from_ref" class="anchor">§</a><h4 class="code-header">fn <a class="fn">from_ref</a>(input: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&T</a>) -> T</h4></section></summary><div class='docblock'>Converts to this type from a reference to the input type.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-FutureExt-for-T" class="impl"><a href="#impl-FutureExt-for-T" class="anchor">§</a><h3 class="code-header">impl<T> FutureExt for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_context" class="method trait-impl"><a href="#method.with_context" class="anchor">§</a><h4 class="code-header">fn <a class="fn">with_context</a>(self, otel_cx: Context) -> WithContext<Self></h4></section></summary><div class='docblock'>Attaches the provided <a href="Context"><code>Context</code></a> to this type, returning a <code>WithContext</code>
|
||
wrapper. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.with_current_context" class="method trait-impl"><a href="#method.with_current_context" class="anchor">§</a><h4 class="code-header">fn <a class="fn">with_current_context</a>(self) -> WithContext<Self></h4></section></summary><div class='docblock'>Attaches the current <a href="Context"><code>Context</code></a> to this type, returning a <code>WithContext</code>
|
||
wrapper. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Instrument-for-T" class="impl"><a href="#impl-Instrument-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Instrument for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.instrument" class="method trait-impl"><a href="#method.instrument" class="anchor">§</a><h4 class="code-header">fn <a class="fn">instrument</a>(self, span: Span) -> Instrumented<Self></h4></section></summary><div class='docblock'>Instruments this type with the provided [<code>Span</code>], returning an
|
||
<code>Instrumented</code> wrapper. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.in_current_span" class="method trait-impl"><a href="#method.in_current_span" class="anchor">§</a><h4 class="code-header">fn <a class="fn">in_current_span</a>(self) -> Instrumented<Self></h4></section></summary><div class='docblock'>Instruments this type with the <a href="super::Span::current()">current</a> <a href="crate::Span"><code>Span</code></a>, returning an
|
||
<code>Instrumented</code> wrapper. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#767-769">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#777">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
||
<p>That is, this conversion is whatever the implementation of
|
||
<code><a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoRequest%3CT%3E-for-T" class="impl"><a href="#impl-IntoRequest%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> IntoRequest<T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_request" class="method trait-impl"><a href="#method.into_request" class="anchor">§</a><h4 class="code-header">fn <a class="fn">into_request</a>(self) -> Request<T></h4></section></summary><div class='docblock'>Wrap the input message <code>T</code> in a <code>tonic::Request</code></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-LayerExt%3CL%3E-for-L" class="impl"><a href="#impl-LayerExt%3CL%3E-for-L" class="anchor">§</a><h3 class="code-header">impl<L> LayerExt<L> for L</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.named_layer" class="method trait-impl"><a href="#method.named_layer" class="anchor">§</a><h4 class="code-header">fn <a class="fn">named_layer</a><S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S><div class="where">where
|
||
L: Layer<S>,</div></h4></section></summary><div class='docblock'>Applies the layer to a service and wraps it in [<code>Layered</code>].</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Pipe-for-T" class="impl"><a href="#impl-Pipe-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Pipe for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.pipe" class="method trait-impl"><a href="#method.pipe" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe</a><R>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self) -> R) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Pipes by value. This is generally the method you want to use. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_ref" class="method trait-impl"><a href="#method.pipe_ref" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_ref</a><'a, R>(&'a self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&'a Self) -> R) -> R<div class="where">where
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Borrows <code>self</code> and passes that borrow into the pipe function. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_ref_mut" class="method trait-impl"><a href="#method.pipe_ref_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_ref_mut</a><'a, R>(&'a mut self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&'a mut Self) -> R) -> R<div class="where">where
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Mutably borrows <code>self</code> and passes that borrow into the pipe function. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_borrow" class="method trait-impl"><a href="#method.pipe_borrow" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_borrow</a><'a, B, R>(&'a self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a B</a>) -> R) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><B>,
|
||
B: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Borrows <code>self</code>, then passes <code>self.borrow()</code> into the pipe function. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_borrow_mut" class="method trait-impl"><a href="#method.pipe_borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_borrow_mut</a><'a, B, R>(
|
||
&'a mut self,
|
||
func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut B</a>) -> R,
|
||
) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><B>,
|
||
B: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Mutably borrows <code>self</code>, then passes <code>self.borrow_mut()</code> into the pipe
|
||
function. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_as_ref" class="method trait-impl"><a href="#method.pipe_as_ref" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_as_ref</a><'a, U, R>(&'a self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a U</a>) -> R) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><U>,
|
||
U: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Borrows <code>self</code>, then passes <code>self.as_ref()</code> into the pipe function.</div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_as_mut" class="method trait-impl"><a href="#method.pipe_as_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_as_mut</a><'a, U, R>(&'a mut self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut U</a>) -> R) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><U>,
|
||
U: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Mutably borrows <code>self</code>, then passes <code>self.as_mut()</code> into the pipe
|
||
function.</div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_deref" class="method trait-impl"><a href="#method.pipe_deref" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_deref</a><'a, T, R>(&'a self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a T</a>) -> R) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = T>,
|
||
T: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Borrows <code>self</code>, then passes <code>self.deref()</code> into the pipe function.</div></details><details class="toggle method-toggle" open><summary><section id="method.pipe_deref_mut" class="method trait-impl"><a href="#method.pipe_deref_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">pipe_deref_mut</a><'a, T, R>(
|
||
&'a mut self,
|
||
func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut T</a>) -> R,
|
||
) -> R<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a><Target = T> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>,
|
||
T: 'a + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
R: 'a,</div></h4></section></summary><div class='docblock'>Mutably borrows <code>self</code>, then passes <code>self.deref_mut()</code> into the pipe
|
||
function.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-PolicyExt-for-T" class="impl"><a href="#impl-PolicyExt-for-T" class="anchor">§</a><h3 class="code-header">impl<T> PolicyExt for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.and" class="method trait-impl"><a href="#method.and" class="anchor">§</a><h4 class="code-header">fn <a class="fn">and</a><P, B, E>(self, other: P) -> And<T, P><div class="where">where
|
||
T: Policy<B, E>,
|
||
P: Policy<B, E>,</div></h4></section></summary><div class='docblock'>Create a new <code>Policy</code> that returns [<code>Action::Follow</code>] only if <code>self</code> and <code>other</code> return
|
||
<code>Action::Follow</code>. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.or" class="method trait-impl"><a href="#method.or" class="anchor">§</a><h4 class="code-header">fn <a class="fn">or</a><P, B, E>(self, other: P) -> Or<T, P><div class="where">where
|
||
T: Policy<B, E>,
|
||
P: Policy<B, E>,</div></h4></section></summary><div class='docblock'>Create a new <code>Policy</code> that returns [<code>Action::Follow</code>] if either <code>self</code> or <code>other</code> returns
|
||
<code>Action::Follow</code>. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Same-for-T" class="impl"><a class="src rightside" href="https://docs.rs/typenum/1.18.0/src/typenum/type_operators.rs.html#34">Source</a><a href="#impl-Same-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://docs.rs/typenum/1.18.0/typenum/type_operators/trait.Same.html" title="trait typenum::type_operators::Same">Same</a> for T</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><a class="src rightside" href="https://docs.rs/typenum/1.18.0/src/typenum/type_operators.rs.html#35">Source</a><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="https://docs.rs/typenum/1.18.0/typenum/type_operators/trait.Same.html#associatedtype.Output" class="associatedtype">Output</a> = T</h4></section></summary><div class='docblock'>Should always be <code>Self</code></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ServiceExt-for-T" class="impl"><a href="#impl-ServiceExt-for-T" class="anchor">§</a><h3 class="code-header">impl<T> ServiceExt for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.propagate_header" class="method trait-impl"><a href="#method.propagate_header" class="anchor">§</a><h4 class="code-header">fn <a class="fn">propagate_header</a>(self, header: HeaderName) -> PropagateHeader<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Propagate a header from the request to the response. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.add_extension" class="method trait-impl"><a href="#method.add_extension" class="anchor">§</a><h4 class="code-header">fn <a class="fn">add_extension</a><T>(self, value: T) -> AddExtension<Self, T><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Add some shareable value to <a href="https://docs.rs/http/latest/http/struct.Extensions.html">request extensions</a>. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.map_request_body" class="method trait-impl"><a href="#method.map_request_body" class="anchor">§</a><h4 class="code-header">fn <a class="fn">map_request_body</a><F>(self, f: F) -> MapRequestBody<Self, F><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Apply a transformation to the request body. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.map_response_body" class="method trait-impl"><a href="#method.map_response_body" class="anchor">§</a><h4 class="code-header">fn <a class="fn">map_response_body</a><F>(self, f: F) -> MapResponseBody<Self, F><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Apply a transformation to the response body. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.compression" class="method trait-impl"><a href="#method.compression" class="anchor">§</a><h4 class="code-header">fn <a class="fn">compression</a>(self) -> Compression<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compresses response bodies. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.decompression" class="method trait-impl"><a href="#method.decompression" class="anchor">§</a><h4 class="code-header">fn <a class="fn">decompression</a>(self) -> Decompression<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Decompress response bodies. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.trace_for_http" class="method trait-impl"><a href="#method.trace_for_http" class="anchor">§</a><h4 class="code-header">fn <a class="fn">trace_for_http</a>(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>High level tracing that classifies responses using HTTP status codes. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.trace_for_grpc" class="method trait-impl"><a href="#method.trace_for_grpc" class="anchor">§</a><h4 class="code-header">fn <a class="fn">trace_for_grpc</a>(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>High level tracing that classifies responses using gRPC headers. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.follow_redirects" class="method trait-impl"><a href="#method.follow_redirects" class="anchor">§</a><h4 class="code-header">fn <a class="fn">follow_redirects</a>(self) -> FollowRedirect<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Follow redirect resposes using the <a href="crate::follow_redirect::policy::Standard"><code>Standard</code></a> policy. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.sensitive_headers" class="method trait-impl"><a href="#method.sensitive_headers" class="anchor">§</a><h4 class="code-header">fn <a class="fn">sensitive_headers</a>(
|
||
self,
|
||
headers: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = HeaderName>,
|
||
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Mark headers as <a href="https://docs.rs/http/latest/http/header/struct.HeaderValue.html#method.set_sensitive">sensitive</a> on both requests and responses. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.sensitive_request_headers" class="method trait-impl"><a href="#method.sensitive_request_headers" class="anchor">§</a><h4 class="code-header">fn <a class="fn">sensitive_request_headers</a>(
|
||
self,
|
||
headers: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = HeaderName>,
|
||
) -> SetSensitiveRequestHeaders<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Mark headers as <a href="https://docs.rs/http/latest/http/header/struct.HeaderValue.html#method.set_sensitive">sensitive</a> on requests. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.sensitive_response_headers" class="method trait-impl"><a href="#method.sensitive_response_headers" class="anchor">§</a><h4 class="code-header">fn <a class="fn">sensitive_response_headers</a>(
|
||
self,
|
||
headers: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = HeaderName>,
|
||
) -> SetSensitiveResponseHeaders<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Mark headers as <a href="https://docs.rs/http/latest/http/header/struct.HeaderValue.html#method.set_sensitive">sensitive</a> on responses. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.override_request_header" class="method trait-impl"><a href="#method.override_request_header" class="anchor">§</a><h4 class="code-header">fn <a class="fn">override_request_header</a><M>(
|
||
self,
|
||
header_name: HeaderName,
|
||
make: M,
|
||
) -> SetRequestHeader<Self, M><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Insert a header into the request. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.append_request_header" class="method trait-impl"><a href="#method.append_request_header" class="anchor">§</a><h4 class="code-header">fn <a class="fn">append_request_header</a><M>(
|
||
self,
|
||
header_name: HeaderName,
|
||
make: M,
|
||
) -> SetRequestHeader<Self, M><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Append a header into the request. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.insert_request_header_if_not_present" class="method trait-impl"><a href="#method.insert_request_header_if_not_present" class="anchor">§</a><h4 class="code-header">fn <a class="fn">insert_request_header_if_not_present</a><M>(
|
||
self,
|
||
header_name: HeaderName,
|
||
make: M,
|
||
) -> SetRequestHeader<Self, M><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Insert a header into the request, if the header is not already present. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.override_response_header" class="method trait-impl"><a href="#method.override_response_header" class="anchor">§</a><h4 class="code-header">fn <a class="fn">override_response_header</a><M>(
|
||
self,
|
||
header_name: HeaderName,
|
||
make: M,
|
||
) -> SetResponseHeader<Self, M><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Insert a header into the response. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.append_response_header" class="method trait-impl"><a href="#method.append_response_header" class="anchor">§</a><h4 class="code-header">fn <a class="fn">append_response_header</a><M>(
|
||
self,
|
||
header_name: HeaderName,
|
||
make: M,
|
||
) -> SetResponseHeader<Self, M><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Append a header into the response. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.insert_response_header_if_not_present" class="method trait-impl"><a href="#method.insert_response_header_if_not_present" class="anchor">§</a><h4 class="code-header">fn <a class="fn">insert_response_header_if_not_present</a><M>(
|
||
self,
|
||
header_name: HeaderName,
|
||
make: M,
|
||
) -> SetResponseHeader<Self, M><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Insert a header into the response, if the header is not already present. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.set_request_id" class="method trait-impl"><a href="#method.set_request_id" class="anchor">§</a><h4 class="code-header">fn <a class="fn">set_request_id</a><M>(
|
||
self,
|
||
header_name: HeaderName,
|
||
make_request_id: M,
|
||
) -> SetRequestId<Self, M><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
M: MakeRequestId,</div></h4></section></summary><div class='docblock'>Add request id header and extension. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.set_x_request_id" class="method trait-impl"><a href="#method.set_x_request_id" class="anchor">§</a><h4 class="code-header">fn <a class="fn">set_x_request_id</a><M>(self, make_request_id: M) -> SetRequestId<Self, M><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
M: MakeRequestId,</div></h4></section></summary><div class='docblock'>Add request id header and extension, using <code>x-request-id</code> as the header name. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.propagate_request_id" class="method trait-impl"><a href="#method.propagate_request_id" class="anchor">§</a><h4 class="code-header">fn <a class="fn">propagate_request_id</a>(
|
||
self,
|
||
header_name: HeaderName,
|
||
) -> PropagateRequestId<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Propgate request ids from requests to responses. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.propagate_x_request_id" class="method trait-impl"><a href="#method.propagate_x_request_id" class="anchor">§</a><h4 class="code-header">fn <a class="fn">propagate_x_request_id</a>(self) -> PropagateRequestId<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Propgate request ids from requests to responses, using <code>x-request-id</code> as the header name. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.catch_panic" class="method trait-impl"><a href="#method.catch_panic" class="anchor">§</a><h4 class="code-header">fn <a class="fn">catch_panic</a>(self) -> CatchPanic<Self, DefaultResponseForPanic><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Catch panics and convert them into <code>500 Internal Server</code> responses. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.request_body_limit" class="method trait-impl"><a href="#method.request_body_limit" class="anchor">§</a><h4 class="code-header">fn <a class="fn">request_body_limit</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> RequestBodyLimit<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Intercept requests with over-sized payloads and convert them into
|
||
<code>413 Payload Too Large</code> responses. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.trim_trailing_slash" class="method trait-impl"><a href="#method.trim_trailing_slash" class="anchor">§</a><h4 class="code-header">fn <a class="fn">trim_trailing_slash</a>(self) -> NormalizePath<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Remove trailing slashes from paths. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.append_trailing_slash" class="method trait-impl"><a href="#method.append_trailing_slash" class="anchor">§</a><h4 class="code-header">fn <a class="fn">append_trailing_slash</a>(self) -> NormalizePath<Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Append trailing slash to paths. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Tap-for-T" class="impl"><a href="#impl-Tap-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Tap for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.tap" class="method trait-impl"><a href="#method.tap" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap</a>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&Self)) -> Self</h4></section></summary><div class='docblock'>Immutable access to a value. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.tap_mut" class="method trait-impl"><a href="#method.tap_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_mut</a>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&mut Self)) -> Self</h4></section></summary><div class='docblock'>Mutable access to a value. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.tap_borrow" class="method trait-impl"><a href="#method.tap_borrow" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_borrow</a><B>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&B</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><B>,
|
||
B: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Immutable access to the <code>Borrow<B></code> of a value. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.tap_borrow_mut" class="method trait-impl"><a href="#method.tap_borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_borrow_mut</a><B>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut B</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><B>,
|
||
B: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Mutable access to the <code>BorrowMut<B></code> of a value. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.tap_ref" class="method trait-impl"><a href="#method.tap_ref" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_ref</a><R>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&R</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><R>,
|
||
R: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Immutable access to the <code>AsRef<R></code> view of a value. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.tap_ref_mut" class="method trait-impl"><a href="#method.tap_ref_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_ref_mut</a><R>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut R</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><R>,
|
||
R: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Mutable access to the <code>AsMut<R></code> view of a value. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.tap_deref" class="method trait-impl"><a href="#method.tap_deref" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_deref</a><T>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&T</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = T>,
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Immutable access to the <code>Deref::Target</code> of a value. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.tap_deref_mut" class="method trait-impl"><a href="#method.tap_deref_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_deref_mut</a><T>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a><Target = T> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>,
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Mutable access to the <code>Deref::Target</code> of a value. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.tap_dbg" class="method trait-impl"><a href="#method.tap_dbg" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_dbg</a>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&Self)) -> Self</h4></section></summary><div class='docblock'>Calls <code>.tap()</code> only in debug builds, and is erased in release builds.</div></details><details class="toggle method-toggle" open><summary><section id="method.tap_mut_dbg" class="method trait-impl"><a href="#method.tap_mut_dbg" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_mut_dbg</a>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&mut Self)) -> Self</h4></section></summary><div class='docblock'>Calls <code>.tap_mut()</code> only in debug builds, and is erased in release
|
||
builds.</div></details><details class="toggle method-toggle" open><summary><section id="method.tap_borrow_dbg" class="method trait-impl"><a href="#method.tap_borrow_dbg" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_borrow_dbg</a><B>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&B</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><B>,
|
||
B: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Calls <code>.tap_borrow()</code> only in debug builds, and is erased in release
|
||
builds.</div></details><details class="toggle method-toggle" open><summary><section id="method.tap_borrow_mut_dbg" class="method trait-impl"><a href="#method.tap_borrow_mut_dbg" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_borrow_mut_dbg</a><B>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut B</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><B>,
|
||
B: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Calls <code>.tap_borrow_mut()</code> only in debug builds, and is erased in release
|
||
builds.</div></details><details class="toggle method-toggle" open><summary><section id="method.tap_ref_dbg" class="method trait-impl"><a href="#method.tap_ref_dbg" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_ref_dbg</a><R>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&R</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><R>,
|
||
R: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Calls <code>.tap_ref()</code> only in debug builds, and is erased in release
|
||
builds.</div></details><details class="toggle method-toggle" open><summary><section id="method.tap_ref_mut_dbg" class="method trait-impl"><a href="#method.tap_ref_mut_dbg" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_ref_mut_dbg</a><R>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut R</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><R>,
|
||
R: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Calls <code>.tap_ref_mut()</code> only in debug builds, and is erased in release
|
||
builds.</div></details><details class="toggle method-toggle" open><summary><section id="method.tap_deref_dbg" class="method trait-impl"><a href="#method.tap_deref_dbg" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_deref_dbg</a><T>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&T</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = T>,
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Calls <code>.tap_deref()</code> only in debug builds, and is erased in release
|
||
builds.</div></details><details class="toggle method-toggle" open><summary><section id="method.tap_deref_mut_dbg" class="method trait-impl"><a href="#method.tap_deref_mut_dbg" class="anchor">§</a><h4 class="code-header">fn <a class="fn">tap_deref_mut_dbg</a><T>(self, func: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a>)) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a><Target = T> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>,
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Calls <code>.tap_deref_mut()</code> only in debug builds, and is erased in release
|
||
builds.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#84-86">Source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#88">Source</a><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#89">Source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&self) -> T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#93">Source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryConv-for-T" class="impl"><a href="#impl-TryConv-for-T" class="anchor">§</a><h3 class="code-header">impl<T> TryConv for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.try_conv" class="method trait-impl"><a href="#method.try_conv" class="anchor">§</a><h4 class="code-header">fn <a class="fn">try_conv</a><T>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" title="type core::convert::TryInto::Error">Error</a>><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><T>,</div></h4></section></summary><div class='docblock'>Attempts to convert <code>self</code> into <code>T</code> using <code>TryInto<T></code>. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#827-829">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#831">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#834">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#811-813">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#815">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#818">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-VZip%3CV%3E-for-T" class="impl"><a href="#impl-VZip%3CV%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<V, T> VZip<V> for T<div class="where">where
|
||
V: MultiLane<T>,</div></h3></section></summary><div class="impl-items"><section id="method.vzip" class="method trait-impl"><a href="#method.vzip" class="anchor">§</a><h4 class="code-header">fn <a class="fn">vzip</a>(self) -> V</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-WithSubscriber-for-T" class="impl"><a href="#impl-WithSubscriber-for-T" class="anchor">§</a><h3 class="code-header">impl<T> WithSubscriber for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_subscriber" class="method trait-impl"><a href="#method.with_subscriber" class="anchor">§</a><h4 class="code-header">fn <a class="fn">with_subscriber</a><S>(self, subscriber: S) -> WithDispatch<Self><div class="where">where
|
||
S: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><Dispatch>,</div></h4></section></summary><div class='docblock'>Attaches the provided <a href="super::Subscriber"><code>Subscriber</code></a> to this type, returning a
|
||
[<code>WithDispatch</code>] wrapper. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.with_current_subscriber" class="method trait-impl"><a href="#method.with_current_subscriber" class="anchor">§</a><h4 class="code-header">fn <a class="fn">with_current_subscriber</a>(self) -> WithDispatch<Self></h4></section></summary><div class='docblock'>Attaches the current <a href="crate::dispatcher#setting-the-default-subscriber">default</a> <a href="super::Subscriber"><code>Subscriber</code></a> to this type, returning a
|
||
[<code>WithDispatch</code>] wrapper. <a>Read more</a></div></details></div></details><section id="impl-Any-for-T-1" class="impl"><a href="#impl-Any-for-T-1" class="anchor">§</a><h3 class="code-header">impl<T> Any for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a>,</div></h3></section><section id="impl-CloneAny-for-T" class="impl"><a href="#impl-CloneAny-for-T" class="anchor">§</a><h3 class="code-header">impl<T> CloneAny for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section><section id="impl-CloneAnySend-for-T" class="impl"><a href="#impl-CloneAnySend-for-T" class="anchor">§</a><h3 class="code-header">impl<T> CloneAnySend for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section><section id="impl-CloneAnySendSync-for-T" class="impl"><a href="#impl-CloneAnySendSync-for-T" class="anchor">§</a><h3 class="code-header">impl<T> CloneAnySendSync for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section><section id="impl-CloneAnySync-for-T" class="impl"><a href="#impl-CloneAnySync-for-T" class="anchor">§</a><h3 class="code-header">impl<T> CloneAnySync for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section><section id="impl-ErasedDestructor-for-T" class="impl"><a href="#impl-ErasedDestructor-for-T" class="anchor">§</a><h3 class="code-header">impl<T> ErasedDestructor for T<div class="where">where
|
||
T: 'static,</div></h3></section><section id="impl-MaybeSend-for-T" class="impl"><a href="#impl-MaybeSend-for-T" class="anchor">§</a><h3 class="code-header">impl<T> MaybeSend for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section></div></section></div></main></body></html> |