1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-30 18:34:36 +01:00
actix-extras/actix_cors/struct.Cors.html

129 lines
61 KiB
HTML
Raw Normal View History

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Builder for CORS middleware."><meta name="keywords" content="rust, rustlang, rust-lang, Cors"><title>Cors in actix_cors - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-9e69e4c014d22d53.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../static.files/light-4743e13df3dfe8c4.css"><link rel="stylesheet" disabled href="../static.files/dark-0e1b889528bd466b.css"><link rel="stylesheet" disabled href="../static.files/ayu-65289d5d067c7c66.css"><script id="default-settings" ></script><script src="../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-4a084badb5778746.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../actix_cors/index.html"><div class="logo-container"><img src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../actix_cors/index.html"><div class="logo-container">
<img src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2 class="location"><a href="#">Cors</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.allow_any_header">allow_any_header</a></li><li><a href="#method.allow_any_method">allow_any_method</a></li><li><a href="#method.allow_any_origin">allow_any_origin</a></li><li><a href="#method.allow_private_network_access">allow_private_network_access</a></li><li><a href="#method.allowed_header">allowed_header</a></li><li><a href="#method.allowed_headers">allowed_headers</a></li><li><a href="#method.allowed_methods">allowed_methods</a></li><li><a href="#method.allowed_origin">allowed_origin</a></li><li><a href="#method.allowed_origin_fn">allowed_origin_fn</a></li><li><a href="#method.block_on_origin_mismatch">block_on_origin_mismatch</a></li><li><a href="#method.disable_preflight">disable_preflight</a></li><li><a href="#method.disable_vary_header">disable_vary_header</a></li><li><a href="#method.expose_any_header">expose_any_header</a></li><li><a href="#method.expose_headers">expose_headers</a></li><li><a href="#method.max_age">max_age</a></li><li><a href="#method.permissive">permissive</a></li><li><a href="#method.send_wildcard">send_wildcard</a></li><li><a href="#method.supports_credentials">supports_credentials</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Debug-for-Cors">Debug</a></li><li><a href="#impl-Default-for-Cors">Default</a></li><li><a href="#impl-Transform%3CS%2C%20ServiceRequest%3E-for-Cors">Transform&lt;S, ServiceRequest&gt;</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-Cors">!RefUnwindSafe</a></li><li><a href="#impl-Send-for-Cors">!Send</a></li><li><a href="#impl-Sync-for-Cors">!Sync</a></li><li><a href="#impl-Unpin-for-Cors">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Cors">!UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-Cors">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-Cors">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Cors">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-Cors">From&lt;T&gt;</a></li><li><a href="#impl-Instrument-for-Cors">Instrument</a></li><li><a href="#impl-Into%3CU%3E-for-Cors">Into&lt;U&gt;</a></li><li><a href="#impl-Same%3CT%3E-for-Cors">Same&lt;T&gt;</a></li><li><a href="#impl-TryFrom%3CU%3E-for-Cors">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-Cors">TryInto&lt;U&gt;</a></li><li><a href="#impl-VZip%3CV%3E-for-Cors">VZip&lt;V&gt;</a></li><li><a href="#impl-WithSubscriber-for-Cors">WithSubscriber</a></li></ul></section><h2><a href="index.html">In actix_cors</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Struct <a href="index.html">actix_cors</a>::<wbr><a class="struct" href="#">Cors</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/actix_cors/builder.rs.html#76-79">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div
<p>To construct a CORS middleware, call <a href="struct.Cors.html#method.default" title="Cors::default()"><code>Cors::default()</code></a> to create a blank, restrictive builder.
Then use any of the builder methods to customize CORS behavior.</p>
<p>The alternative <a href="struct.Cors.html#method.permissive" title="Cors::permissive()"><code>Cors::permissive()</code></a> constructor is available for local development, allowing
all origins and headers, etc. <strong>The permissive constructor should not be used in production.</strong></p>
<h2 id="errors"><a href="#errors">Errors</a></h2>
<p>Errors surface in the middleware initialization phase. This means that, if you have logs enabled
in Actix Web (using <code>env_logger</code> or other crate that exposes logs from the <code>log</code> crate), error
messages will outline what is wrong with the CORS configuration in the server logs and the
server will fail to start up or serve requests.</p>
<h2 id="example"><a href="#example">Example</a></h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_cors::Cors;
<span class="kw">use </span>actix_web::http::header;
<span class="kw">let </span>cors = Cors::default()
.allowed_origin(<span class="string">&quot;https://www.rust-lang.org&quot;</span>)
.allowed_methods(<span class="macro">vec!</span>[<span class="string">&quot;GET&quot;</span>, <span class="string">&quot;POST&quot;</span>])
.allowed_headers(<span class="macro">vec!</span>[header::AUTHORIZATION, header::ACCEPT])
.allowed_header(header::CONTENT_TYPE)
.max_age(<span class="number">3600</span>);
<span class="comment">// `cors` can now be used in `App::wrap`.</span></code></pre></div>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Cors" class="impl has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#81-492">source</a><a href="#impl-Cors" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.permissive" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#86-114">source</a><h4 class="code-header">pub fn <a href="#method.permissive" class="fn">permissive</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>A very permissive set of default for quick development. Not recommended for production use.</p>
<p><em>All</em> origins, methods, request headers and exposed headers allowed. Credentials supported.
Max age 1 hour. Does not send wildcard.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.allow_any_origin" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#119-125">source</a><h4 class="code-header">pub fn <a href="#method.allow_any_origin" class="fn">allow_any_origin</a>(self) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Resets allowed origin list to a state where any origin is accepted.</p>
<p>See <a href="struct.Cors.html#method.allowed_origin" title="Cors::allowed_origin"><code>Cors::allowed_origin</code></a> for more info on allowed origins.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.allowed_origin" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#151-178">source</a><h4 class="code-header">pub fn <a href="#method.allowed_origin" class="fn">allowed_origin</a>(self, origin: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Add an origin that is allowed to make requests.</p>
<p>This method allows specifying a finite set of origins to verify the value of the <code>Origin</code>
request header. These are <code>origin-or-null</code> types in the <a href="https://fetch.spec.whatwg.org/#origin-header">Fetch Standard</a>.</p>
<p>By default, no origins are accepted.</p>
<p>When this list is set, the clients <code>Origin</code> request header will be checked in a
case-sensitive manner.</p>
<p>When all origins are allowed and <code>send_wildcard</code> is set, <code>*</code> will be sent in the
<code>Access-Control-Allow-Origin</code> response header. If <code>send_wildcard</code> is not set, the clients
<code>Origin</code> request header will be echoed back in the <code>Access-Control-Allow-Origin</code>
response header.</p>
<p>If the origin of the request doesnt match any allowed origins and at least one
<code>allowed_origin_fn</code> function is set, these functions will be used to determinate
allowed origins.</p>
<h5 id="initialization-errors"><a href="#initialization-errors">Initialization Errors</a></h5>
<ul>
<li>If supplied origin is not valid uri</li>
<li>If supplied origin is a wildcard (<code>*</code>). <a href="struct.Cors.html#method.send_wildcard" title="Cors::send_wildcard"><code>Cors::send_wildcard</code></a> should be used instead.</li>
</ul>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.allowed_origin_fn" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#188-199">source</a><h4 class="code-header">pub fn <a href="#method.allowed_origin_fn" class="fn">allowed_origin_fn</a>&lt;F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(&amp;<a class="struct" href="https://docs.rs/http/0.2.8/http/header/value/struct.HeaderValue.html" title="struct http::header::value::HeaderValue">HeaderValue</a>, &amp;RequestHead) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> + 'static,</span></h4></section></summary><div class="docblock"><p>Determinate allowed origins by processing requests which didnt match any origins specified
in the <code>allowed_origin</code>.</p>
<p>The function will receive two parameters, the Origin header value, and the <code>RequestHead</code> of
each request, which can be used to determine whether to allow the request or not.</p>
<p>If the function returns <code>true</code>, the clients <code>Origin</code> request header will be echoed back
into the <code>Access-Control-Allow-Origin</code> response header.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.allow_any_method" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#204-210">source</a><h4 class="code-header">pub fn <a href="#method.allow_any_method" class="fn">allow_any_method</a>(self) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Resets allowed methods list to all methods.</p>
<p>See <a href="struct.Cors.html#method.allowed_methods" title="Cors::allowed_methods"><code>Cors::allowed_methods</code></a> for more info on allowed methods.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.allowed_methods" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#220-242">source</a><h4 class="code-header">pub fn <a href="#method.allowed_methods" class="fn">allowed_methods</a>&lt;U, M&gt;(self, methods: U) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <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>&lt;Item = M&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;M: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/method/struct.Method.html" title="struct http::method::Method">Method</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;M as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/method/struct.Method.html" title="struct http::method::Method">Method</a>&gt;&gt;::<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>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Set a list of methods which allowed origins can perform.</p>
<p>These will be sent in the <code>Access-Control-Allow-Methods</code> response header as specified in
the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard CORS protocol</a>.</p>
<p>This defaults to an empty set.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.allow_any_header" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#247-253">source</a><h4 class="code-header">pub fn <a href="#method.allow_any_header" class="fn">allow_any_header</a>(self) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Resets allowed request header list to a state where any header is accepted.</p>
<p>See <a href="struct.Cors.html#method.allowed_headers" title="Cors::allowed_headers"><code>Cors::allowed_headers</code></a> for more info on allowed request headers.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.allowed_header" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#258-280">source</a><h4 class="code-header">pub fn <a href="#method.allowed_header" class="fn">allowed_header</a>&lt;H&gt;(self, header: H) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>&gt;&gt;::<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>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Add an allowed request header.</p>
<p>See <a href="struct.Cors.html#method.allowed_headers" title="Cors::allowed_headers"><code>Cors::allowed_headers</code></a> for more info on allowed request headers.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.allowed_headers" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#292-319">source</a><h4 class="code-header">pub fn <a href="#method.allowed_headers" class="fn">allowed_headers</a>&lt;U, H&gt;(self, headers: U) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <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>&lt;Item = H&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>&gt;&gt;::<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>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Set a list of request header field names which can be used when this resource is accessed by
allowed origins.</p>
<p>If <code>All</code> is set, whatever is requested by the client in <code>Access-Control-Request-Headers</code>
will be echoed back in the <code>Access-Control-Allow-Headers</code> header as specified in
the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard CORS protocol</a>.</p>
<p>This defaults to an empty set.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.expose_any_header" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#324-330">source</a><h4 class="code-header">pub fn <a href="#method.expose_any_header" class="fn">expose_any_header</a>(self) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Resets exposed response header list to a state where all headers are exposed.</p>
<p>See <a href="struct.Cors.html#method.expose_headers" title="Cors::expose_headers"><code>Cors::expose_headers</code></a> for more info on exposed response headers.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.expose_headers" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#339-365">source</a><h4 class="code-header">pub fn <a href="#method.expose_headers" class="fn">expose_headers</a>&lt;U, H&gt;(self, headers: U) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <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>&lt;Item = H&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>&gt;&gt;::<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>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://docs.rs/http/0.2.8/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Set a list of headers which are safe to expose to the API of a CORS API specification.
This corresponds to the <code>Access-Control-Expose-Headers</code> response header as specified in
the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard CORS protocol</a>.</p>
<p>This defaults to an empty set.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.max_age" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#373-379">source</a><h4 class="code-header">pub fn <a href="#method.max_age" class="fn">max_age</a>(self, max_age: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;&gt;) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Set a maximum time (in seconds) for which this CORS request may be cached. This value is set
as the <code>Access-Control-Max-Age</code> header as specified in the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard CORS protocol</a>.</p>
<p>Pass a number (of seconds) or use None to disable sending max age header.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.send_wildcard" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#392-398">source</a><h4 class="code-header">pub fn <a href="#method.send_wildcard" class="fn">send_wildcard</a>(self) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Set to use wildcard origins.</p>
<p>If send wildcard is set and the <code>allowed_origins</code> parameter is <code>All</code>, a wildcard
<code>Access-Control-Allow-Origin</code> response header is sent, rather than the requests
<code>Origin</code> header.</p>
<p>This <strong>CANNOT</strong> be used in conjunction with <code>allowed_origins</code> set to <code>All</code> and
<code>allow_credentials</code> set to <code>true</code>. Depending on the mode of usage, this will either result
in an <code>CorsError::CredentialsWithWildcardOrigin</code> error during actix launch or runtime.</p>
<p>Defaults to <code>false</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.supports_credentials" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#415-421">source</a><h4 class="code-header">pub fn <a href="#method.supports_credentials" class="fn">supports_credentials</a>(self) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Allows users to make authenticated requests</p>
<p>If true, injects the <code>Access-Control-Allow-Credentials</code> header in responses. This allows
cookies and credentials to be submitted across domains as specified in
the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">Fetch Standard CORS protocol</a>.</p>
<p>This option cannot be used in conjunction with an <code>allowed_origin</code> set to <code>All</code> and
<code>send_wildcards</code> set to <code>true</code>.</p>
<p>Defaults to <code>false</code>.</p>
<p>A server initialization error will occur if credentials are allowed, but the Origin is set
to send wildcards (<code>*</code>); this is not allowed by the CORS protocol.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.allow_private_network_access" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#435-441">source</a><h4 class="code-header">pub fn <a href="#method.allow_private_network_access" class="fn">allow_private_network_access</a>(self) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Allow private network access.</p>
<p>If true, injects the <code>Access-Control-Allow-Private-Network: true</code> header in responses if the
request contained the <code>Access-Control-Request-Private-Network: true</code> header.</p>
<p>For more information on this behavior, see the draft <a href="https://wicg.github.io/private-network-access">Private Network Access</a> spec.</p>
<p>Defaults to <code>false</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.disable_vary_header" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#453-459">source</a><h4 class="code-header">pub fn <a href="#method.disable_vary_header" class="fn">disable_vary_header</a>(self) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Disable <code>Vary</code> header support.</p>
<p>When enabled the header <code>Vary: Origin</code> will be returned as per the Fetch Standard
implementation guidelines.</p>
<p>Setting this header when the <code>Access-Control-Allow-Origin</code> is dynamically generated
(eg. when there is more than one allowed origin, and an Origin other than * is returned)
informs CDNs and other caches that the CORS headers are dynamic, and cannot be cached.</p>
<p>By default, <code>Vary</code> header support is enabled.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.disable_preflight" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#467-473">source</a><h4 class="code-header">pub fn <a href="#method.disable_preflight" class="fn">disable_preflight</a>(self) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Disable support for preflight requests.</p>
<p>When enabled CORS middleware automatically handles <code>OPTIONS</code> requests.
This is useful for application level middleware.</p>
<p>By default <em>preflight</em> support is enabled.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.block_on_origin_mismatch" class="method has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#485-491">source</a><h4 class="code-header">pub fn <a href="#method.block_on_origin_mismatch" class="fn">block_on_origin_mismatch</a>(self, block: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>Configures whether requests should be pre-emptively blocked on mismatched origin.</p>
<p>If <code>true</code>, a 400 Bad Request is returned immediately when a request fails origin validation.</p>
<p>If <code>false</code>, the request will be processed as normal but relevant CORS headers will not be
appended to the response. In this case, the browser is trusted to validate CORS headers and
and block requests based on pre-flight requests. Use this setting to allow cURL and other
non-browser HTTP clients to function as normal, no matter what <code>Origin</code> the request has.</p>
<p>Defaults to <code>true</code>.</p>
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-Cors" class="impl has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#75">source</a><a href="#impl-Debug-for-Cors" 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.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#75">source</a><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>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</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><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Default-for-Cors" class="impl has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#494-528">source</a><a href="#impl-Default-for-Cors" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#499-527">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a></h4></section></summary><div class="docblock"><p>A restrictive (security paranoid) set of defaults.</p>
<p><em>No</em> allowed origins, methods, request headers or exposed headers. Credentials
not supported. No max age (will use browsers default).</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Transform%3CS%2C%20ServiceRequest%3E-for-Cors" class="impl has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#530-589">source</a><a href="#impl-Transform%3CS%2C%20ServiceRequest%3E-for-Cors" class="anchor">§</a><h3 class="code-header">impl&lt;S, B&gt; Transform&lt;S, ServiceRequest&gt; for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: Service&lt;ServiceRequest, Response = ServiceResponse&lt;B&gt;, Error = Error&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;S::Future: 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;B: MessageBody + 'static,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Response" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Response" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Response</a> = ServiceResponse&lt;EitherBody&lt;B, BoxBody&gt;&gt;</h4></section></summary><div class='docblock'>Responses produced by the service.</div></details><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Error</a> = Error</h4></section></summary><div class='docblock'>Errors produced by the service.</div></details><details class="rustdoc-toggle" open><summary><section id="associatedtype.InitError" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.InitError" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">InitError</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a></h4></section></summary><div class='docblock'>Errors produced while building a transform service.</div></details><details class="rustdoc-toggle" open><summary><section id="associatedtype.Transform" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Transform" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Transform</a> = CorsMiddleware&lt;S&gt;</h4></section></summary><div class='docblock'>The <code>TransformService</code> value created by this factory</div></details><details class="rustdoc-toggle" open><summary><section id="associatedtype.Future" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Future" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Future</a> = Ready&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;<a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> as Transform&lt;S, ServiceRequest&gt;&gt;::Transform, &lt;<a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> as Transform&lt;S, ServiceRequest&gt;&gt;::InitError&gt;&gt;</h4></section></summary><div class='docblock'>The future response value.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.new_transform" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/actix_cors/builder.rs.html#543-588">source</a><a href="#method.new_transform" class="anchor">§</a><h4 class="code-header">fn <a class="fn">new_transform</a>(&amp;self, service: S) -&gt; Self::Future</h4></section></summary><div class='docblock'>Creates and returns a new Transform component, asynchronously</div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Cors" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-Cors" class="anchor">§</a><h3 class="code-header">impl !<a c
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Instrument-for-Cors" class="impl has-srclink"><a class="srclink rightside" href="https://docs.rs/tracing/0.1.37/src/tracing/instrument.rs.html#276">source</a><a href="#impl-Instrument-for-Cors" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.instrument" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://docs.rs/tracing/0.1.37/src/tracing/instrument.rs.html#82">source</a><a href="#method.instrument" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.Instrument.html#method.instrument" class="fn">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -&gt; <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Instruments this type with the provided <a href="https://docs.rs/tracing/0.1.37/tracing/span/struct.Span.html" title="Span"><code>Span</code></a>, returning an
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.in_current_span" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://docs.rs/tracing/0.1.37/src/tracing/instrument.rs.html#121">source</a><a href="#method.in_current_span" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fn">in_current_span</a>(self) -&gt; <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Instruments this type with the <a href="https://docs.rs/tracing/0.1.37/tracing/span/struct.Span.html#method.current">current</a> <a href="https://docs.rs/tracing/0.1.37/tracing/span/struct.Span.html"><code>Span</code></a>, returning an
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-Cors" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#717">source</a><a href="#impl-Into%3CU%3E-for-Cors" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#725">source</a></span><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) -&gt; 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="From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Same%3CT%3E-for-Cors" class="impl has-srclink"><a class="srclink rightside" href="https://docs.rs/typenum/1.16.0/src/typenum/type_operators.rs.html#34">source</a><a href="#impl-Same%3CT%3E-for-Cors" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://docs.rs/typenum/1.16.0/typenum/type_operators/trait.Same.html" title="trait typenum::type_operators::Same">Same</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="https://docs.rs/typenum/1.16.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="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-Cors" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#775">source</a><a href="#impl-TryFrom%3CU%3E-for-Cors" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><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="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#781">source</a></span><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) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<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>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-Cors" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#760">source</a><a href="#impl-TryInto%3CU%3E-for-Cors" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInt
<a href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.with_current_subscriber" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://docs.rs/tracing/0.1.37/src/tracing/instrument.rs.html#221">source</a><a href="#method.with_current_subscriber" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber" class="fn">with_current_subscriber</a>(self) -&gt; <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Attaches the current <a href="https://docs.rs/tracing/0.1.37/tracing/dispatcher/index.html#setting-the-default-subscriber">default</a> <a href="https://docs.rs/tracing-core/0.1.22/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
<a href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber">Read more</a></div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_cors" data-themes="" data-resource-suffix="" data-rustdoc-version="1.68.0-nightly (659e169d3 2023-01-04)" data-search-js="search-181581080540673f.js" data-settings-js="settings-bebeae96e00e4617.js" data-settings-css="settings-58836c674e2f7bd2.css" ></div></body></html>