mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
151 lines
58 KiB
HTML
151 lines
58 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="Builder for CORS middleware."><title>Cors in actix_cors - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.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-a2c9cd1067f8b328.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-fa3bb1812debf86c.css"><meta name="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.74.0-nightly (3223b0b5e 2023-09-20)" data-channel="nightly" data-search-js="search-8be46b629f5f14a8.js" data-settings-js="settings-74424d7eec62a23e.js" ><script src="../static.files/storage-fec3eaa3851e447d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-c5bd66d33317d69f.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-5d8b3c7633ad77ba.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">☰</button><a class="logo-container" href="../actix_cors/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a></nav><nav class="sidebar"><a class="logo-container" href="../actix_cors/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></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,+ServiceRequest%3E-for-Cors">Transform<S, ServiceRequest></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-UnwindSafe-for-Cors">!UnwindSafe</a></li><li><a href="#impl-Unpin-for-Cors">Unpin</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<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Cors">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-Cors">From<T></a></li><li><a href="#impl-Instrument-for-Cors">Instrument</a></li><li><a href="#impl-Into%3CU%3E-for-Cors">Into<U></a></li><li><a href="#impl-Same%3CT%3E-for-Cors">Same<T></a></li><li><a href="#impl-TryFrom%3CU%3E-for-Cors">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-Cors">TryInto<U></a></li><li><a href="#impl-VZip%3CV%3E-for-Cors">VZip<V></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-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="index.html">actix_cors</a>::<wbr><a class="struct" href="#">Cors</a><button id="copy-path" 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="src" href="../src/actix_cors/builder.rs.html#76-79">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct Cors { /* private fields */ }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Builder for CORS middleware.</p>
|
||
<p>To construct a CORS middleware, call <a href="struct.Cors.html#method.default" title="associated function actix_cors::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="associated function actix_cors::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">"https://www.rust-lang.org"</span>)
|
||
.allowed_methods(<span class="macro">vec!</span>[<span class="string">"GET"</span>, <span class="string">"POST"</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="toggle implementors-toggle" open><summary><section id="impl-Cors" class="impl"><a class="src rightside" href="../src/actix_cors/builder.rs.html#81-491">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="toggle method-toggle" open><summary><section id="method.permissive" class="method"><a class="src 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>() -> 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="toggle method-toggle" open><summary><section id="method.allow_any_origin" class="method"><a class="src 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) -> <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="method actix_cors::Cors::allowed_origin"><code>Cors::allowed_origin</code></a> for more info on allowed origins.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.allowed_origin" class="method"><a class="src 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: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <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 client’s <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 client’s
|
||
<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 doesn’t 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="method actix_cors::Cors::send_wildcard"><code>Cors::send_wildcard</code></a> should be used instead.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.allowed_origin_fn" class="method"><a class="src 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><F>(self, f: F) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where
|
||
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>(&<a class="struct" href="https://docs.rs/http/0.2.9/http/header/value/struct.HeaderValue.html" title="struct http::header::value::HeaderValue">HeaderValue</a>, &RequestHead) -> <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 didn’t 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 client’s <code>Origin</code> request header will be echoed back
|
||
into the <code>Access-Control-Allow-Origin</code> response header.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.allow_any_method" class="method"><a class="src 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) -> <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="method actix_cors::Cors::allowed_methods"><code>Cors::allowed_methods</code></a> for more info on allowed methods.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.allowed_methods" class="method"><a class="src 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><U, M>(self, methods: U) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where
|
||
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><Item = M>,
|
||
M: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.9/http/method/struct.Method.html" title="struct http::method::Method">Method</a>>,
|
||
<M as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.9/http/method/struct.Method.html" title="struct http::method::Method">Method</a>>>::<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><<a class="struct" href="https://docs.rs/http/0.2.9/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>,</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="toggle method-toggle" open><summary><section id="method.allow_any_header" class="method"><a class="src 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) -> <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="method actix_cors::Cors::allowed_headers"><code>Cors::allowed_headers</code></a> for more info on allowed request headers.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.allowed_header" class="method"><a class="src 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><H>(self, header: H) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where
|
||
H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.9/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>,
|
||
<H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.9/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>>::<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><<a class="struct" href="https://docs.rs/http/0.2.9/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>,</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="method actix_cors::Cors::allowed_headers"><code>Cors::allowed_headers</code></a> for more info on allowed request headers.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.allowed_headers" class="method"><a class="src 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><U, H>(self, headers: U) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where
|
||
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><Item = H>,
|
||
H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.9/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>,
|
||
<H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.9/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>>::<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><<a class="struct" href="https://docs.rs/http/0.2.9/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>,</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="toggle method-toggle" open><summary><section id="method.expose_any_header" class="method"><a class="src 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) -> <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="method actix_cors::Cors::expose_headers"><code>Cors::expose_headers</code></a> for more info on exposed response headers.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.expose_headers" class="method"><a class="src 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><U, H>(self, headers: U) -> <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where
|
||
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><Item = H>,
|
||
H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.9/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>,
|
||
<H as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><<a class="struct" href="https://docs.rs/http/0.2.9/http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>>>::<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><<a class="struct" href="https://docs.rs/http/0.2.9/http/error/struct.Error.html" title="struct http::error::Error">HttpError</a>>,</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="toggle method-toggle" open><summary><section id="method.max_age" class="method"><a class="src 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><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>>>) -> <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="toggle method-toggle" open><summary><section id="method.send_wildcard" class="method"><a class="src 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) -> <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 request’s
|
||
<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="toggle method-toggle" open><summary><section id="method.supports_credentials" class="method"><a class="src 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) -> <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="toggle method-toggle" open><summary><section id="method.allow_private_network_access" class="method"><a class="src rightside" href="../src/actix_cors/builder.rs.html#434-440">source</a><h4 class="code-header">pub fn <a href="#method.allow_private_network_access" class="fn">allow_private_network_access</a>(self) -> <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="toggle method-toggle" open><summary><section id="method.disable_vary_header" class="method"><a class="src rightside" href="../src/actix_cors/builder.rs.html#452-458">source</a><h4 class="code-header">pub fn <a href="#method.disable_vary_header" class="fn">disable_vary_header</a>(self) -> <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="toggle method-toggle" open><summary><section id="method.disable_preflight" class="method"><a class="src rightside" href="../src/actix_cors/builder.rs.html#466-472">source</a><h4 class="code-header">pub fn <a href="#method.disable_preflight" class="fn">disable_preflight</a>(self) -> <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="toggle method-toggle" open><summary><section id="method.block_on_origin_mismatch" class="method"><a class="src rightside" href="../src/actix_cors/builder.rs.html#484-490">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>) -> <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="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Cors" class="impl"><a class="src 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="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src 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>(&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="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="toggle implementors-toggle" open><summary><section id="impl-Default-for-Cors" class="impl"><a class="src rightside" href="../src/actix_cors/builder.rs.html#493-527">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="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../src/actix_cors/builder.rs.html#498-526">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>() -> <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 browser’s default).</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Transform%3CS,+ServiceRequest%3E-for-Cors" class="impl"><a class="src rightside" href="../src/actix_cors/builder.rs.html#529-588">source</a><a href="#impl-Transform%3CS,+ServiceRequest%3E-for-Cors" class="anchor">§</a><h3 class="code-header">impl<S, B> Transform<S, ServiceRequest> for <a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a><span class="where fmt-newline">where
|
||
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
|
||
S::Future: 'static,
|
||
B: MessageBody + 'static,</span></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Response" class="associatedtype trait-impl"><a href="#associatedtype.Response" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Response</a> = ServiceResponse<EitherBody<B, BoxBody>></h4></section></summary><div class='docblock'>Responses produced by the service.</div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><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="toggle" open><summary><section id="associatedtype.InitError" class="associatedtype trait-impl"><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="toggle" open><summary><section id="associatedtype.Transform" class="associatedtype trait-impl"><a href="#associatedtype.Transform" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Transform</a> = CorsMiddleware<S></h4></section></summary><div class='docblock'>The <code>TransformService</code> value created by this factory</div></details><details class="toggle" open><summary><section id="associatedtype.Future" class="associatedtype trait-impl"><a href="#associatedtype.Future" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Future</a> = Ready<<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.Cors.html" title="struct actix_cors::Cors">Cors</a> as Transform<S, ServiceRequest>>::Transform, <<a class="struct" href="struct.Cors.html" title="struct actix_cors::Cors">Cors</a> as Transform<S, ServiceRequest>>::InitError>></h4></section></summary><div class='docblock'>The future response value.</div></details><details class="toggle method-toggle" open><summary><section id="method.new_transform" class="method trait-impl"><a class="src rightside" href="../src/actix_cors/builder.rs.html#542-587">source</a><a href="#method.new_transform" class="anchor">§</a><h4 class="code-header">fn <a class="fn">new_transform</a>(&self, service: S) -> 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"><a href="#impl-RefUnwindSafe-for-Cors" 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.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></section><section id="impl-Send-for-Cors" class="impl"><a href="#impl-Send-for-Cors" 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.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></section><section id="impl-Sync-for-Cors" class="impl"><a href="#impl-Sync-for-Cors" 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.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></section><section id="impl-Unpin-for-Cors" class="impl"><a href="#impl-Unpin-for-Cors" 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.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></section><section id="impl-UnwindSafe-for-Cors" class="impl"><a href="#impl-UnwindSafe-for-Cors" 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.Cors.html" title="struct actix_cors::Cors">Cors</a></h3></section></div><h2 id="blanket-implementations" class="small-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-Cors" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#135">source</a><a href="#impl-Any-for-Cors" 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<span class="where fmt-newline">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>,</span></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#136">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-Cors" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-Cors" 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<span class="where fmt-newline">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></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#210">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-Cors" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-Cors" 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<span class="where fmt-newline">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></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#217">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-From%3CT%3E-for-Cors" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#722">source</a><a href="#impl-From%3CT%3E-for-Cors" 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#725">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-Instrument-for-Cors" class="impl"><a class="src 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<T> <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="toggle method-toggle" open><summary><section id="method.instrument" class="method trait-impl"><a class="src 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>) -> <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></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="struct tracing::span::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="toggle method-toggle" open><summary><section id="method.in_current_span" class="method trait-impl"><a class="src 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) -> <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></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" title="associated function tracing::span::Span::current">current</a> <a href="https://docs.rs/tracing/0.1.37/tracing/span/struct.Span.html" title="struct tracing::span::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.in_current_span">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-Cors" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#706">source</a><a href="#impl-Into%3CU%3E-for-Cors" 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<span class="where fmt-newline">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>,</span></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#715">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-Same%3CT%3E-for-Cors" class="impl"><a class="src rightside" href="https://docs.rs/typenum/1.17.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<T> <a class="trait" href="https://docs.rs/typenum/1.17.0/typenum/type_operators/trait.Same.html" title="trait typenum::type_operators::Same">Same</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="https://docs.rs/typenum/1.17.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-TryFrom%3CU%3E-for-Cors" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#762">source</a><a href="#impl-TryFrom%3CU%3E-for-Cors" 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<span class="where fmt-newline">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>,</span></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a href="#associatedtype.Error-2" 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#769">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-Cors" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#747">source</a><a href="#impl-TryInto%3CU%3E-for-Cors" 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<span class="where fmt-newline">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>,</span></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" 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#754">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-Cors" class="impl"><a href="#impl-VZip%3CV%3E-for-Cors" class="anchor">§</a><h3 class="code-header">impl<V, T> VZip<V> for T<span class="where fmt-newline">where
|
||
V: MultiLane<T>,</span></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-Cors" class="impl"><a class="src rightside" href="https://docs.rs/tracing/0.1.37/src/tracing/instrument.rs.html#334">source</a><a href="#impl-WithSubscriber-for-Cors" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.37/tracing/instrument/trait.WithSubscriber.html" title="trait tracing::instrument::WithSubscriber">WithSubscriber</a> 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 class="src rightside" href="https://docs.rs/tracing/0.1.37/src/tracing/instrument.rs.html#169-171">source</a><a href="#method.with_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_subscriber" class="fn">with_subscriber</a><S>(self, subscriber: S) -> <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self><span class="where fmt-newline">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>,</span></h4></section></summary><div class='docblock'>Attaches the provided <a href="super::Subscriber"><code>Subscriber</code></a> to this type, returning a
|
||
<a href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::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="toggle method-toggle" open><summary><section id="method.with_current_subscriber" class="method trait-impl"><a class="src 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) -> <a class="struct" href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self></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" title="mod tracing::dispatcher">default</a> <a href="super::Subscriber"><code>Subscriber</code></a> to this type, returning a
|
||
<a href="https://docs.rs/tracing/0.1.37/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::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></body></html> |