mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 17:52:56 +01:00
289 lines
77 KiB
HTML
289 lines
77 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="An HTTP Server."><title>HttpServer in actix_web - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_web" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.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" title="show sidebar"></button><a class="logo-container" href="../actix_web/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><h2 class="location"><a href="#">HttpServer</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.addrs">addrs</a></li><li><a href="#method.addrs_with_scheme">addrs_with_scheme</a></li><li><a href="#method.backlog">backlog</a></li><li><a href="#method.bind">bind</a></li><li><a href="#method.bind_auto_h2c">bind_auto_h2c</a></li><li><a href="#method.bind_openssl">bind_openssl</a></li><li><a href="#method.bind_rustls">bind_rustls</a></li><li><a href="#method.bind_rustls_021">bind_rustls_021</a></li><li><a href="#method.bind_rustls_0_22">bind_rustls_0_22</a></li><li><a href="#method.bind_rustls_0_23">bind_rustls_0_23</a></li><li><a href="#method.bind_uds">bind_uds</a></li><li><a href="#method.client_disconnect_timeout">client_disconnect_timeout</a></li><li><a href="#method.client_request_timeout">client_request_timeout</a></li><li><a href="#method.disable_signals">disable_signals</a></li><li><a href="#method.keep_alive">keep_alive</a></li><li><a href="#method.listen">listen</a></li><li><a href="#method.listen_auto_h2c">listen_auto_h2c</a></li><li><a href="#method.listen_openssl">listen_openssl</a></li><li><a href="#method.listen_rustls">listen_rustls</a></li><li><a href="#method.listen_rustls_0_21">listen_rustls_0_21</a></li><li><a href="#method.listen_rustls_0_22">listen_rustls_0_22</a></li><li><a href="#method.listen_rustls_0_23">listen_rustls_0_23</a></li><li><a href="#method.listen_uds">listen_uds</a></li><li><a href="#method.max_connection_rate">max_connection_rate</a></li><li><a href="#method.max_connections">max_connections</a></li><li><a href="#method.new">new</a></li><li><a href="#method.on_connect">on_connect</a></li><li><a href="#method.run">run</a></li><li><a href="#method.server_hostname">server_hostname</a></li><li><a href="#method.shutdown_timeout">shutdown_timeout</a></li><li><a href="#method.system_exi
|
|||
|
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>() -> I + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + 'static,
|
|||
|
I: IntoServiceFactory<S, <a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>>,
|
|||
|
S: <a class="trait" href="dev/trait.ServiceFactory.html" title="trait actix_web::dev::ServiceFactory">ServiceFactory</a><<a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>, Config = <a class="struct" href="dev/struct.AppConfig.html" title="struct actix_web::dev::AppConfig">AppConfig</a>>,
|
|||
|
S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Error" title="type actix_web::dev::ServiceFactory::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="error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>,
|
|||
|
S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.InitError" title="type actix_web::dev::ServiceFactory::InitError">InitError</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,
|
|||
|
S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Response" title="type actix_web::dev::ServiceFactory::Response">Response</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="dev/struct.Response.html" title="struct actix_web::dev::Response">Response</a><B>>,
|
|||
|
B: <a class="trait" href="body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a>,</div>{ <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An HTTP Server.</p>
|
|||
|
<p>Create new HTTP server with application factory.</p>
|
|||
|
<h2 id="automatic-http-version-selection"><a class="doc-anchor" href="#automatic-http-version-selection">§</a>Automatic HTTP Version Selection</h2>
|
|||
|
<p>There are two ways to select the HTTP version of an incoming connection:</p>
|
|||
|
<ul>
|
|||
|
<li>One is to rely on the ALPN information that is provided when using a TLS (HTTPS); both
|
|||
|
versions are supported automatically when using either of the <code>.bind_rustls()</code> or
|
|||
|
<code>.bind_openssl()</code> methods.</li>
|
|||
|
<li>The other is to read the first few bytes of the TCP stream. This is the only viable approach
|
|||
|
for supporting H2C, which allows the HTTP/2 protocol to work over plaintext connections. Use
|
|||
|
the <code>.bind_auto_h2c()</code> method to enable this behavior.</li>
|
|||
|
</ul>
|
|||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_web::{web, App, HttpResponse, HttpServer};
|
|||
|
|
|||
|
<span class="attr">#[actix_web::main]
|
|||
|
</span><span class="kw">async fn </span>main() -> std::io::Result<()> {
|
|||
|
HttpServer::new(|| {
|
|||
|
App::new()
|
|||
|
.service(web::resource(<span class="string">"/"</span>).to(|| <span class="kw">async </span>{ <span class="string">"hello world" </span>}))
|
|||
|
})
|
|||
|
.bind((<span class="string">"127.0.0.1"</span>, <span class="number">8080</span>))<span class="question-mark">?
|
|||
|
</span>.run()
|
|||
|
.<span class="kw">await
|
|||
|
</span>}</code></pre></div>
|
|||
|
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-HttpServer%3CF,+I,+S,+B%3E" class="impl"><a class="src rightside" href="../src/actix_web/server.rs.html#93-1037">source</a><a href="#impl-HttpServer%3CF,+I,+S,+B%3E" class="anchor">§</a><h3 class="code-header">impl<F, I, S, B> <a class="struct" href="struct.HttpServer.html" title="struct actix_web::HttpServer">HttpServer</a><F, I, S, B><div class="where">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>() -> I + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + 'static,
|
|||
|
I: IntoServiceFactory<S, <a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>>,
|
|||
|
S: <a class="trait" href="dev/trait.ServiceFactory.html" title="trait actix_web::dev::ServiceFactory">ServiceFactory</a><<a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>, Config = <a class="struct" href="dev/struct.AppConfig.html" title="struct actix_web::dev::AppConfig">AppConfig</a>> + 'static,
|
|||
|
S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Error" title="type actix_web::dev::ServiceFactory::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="error/struct.Error.html" title="struct actix_web::error::Error">Error</a>> + 'static,
|
|||
|
S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.InitError" title="type actix_web::dev::ServiceFactory::InitError">InitError</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,
|
|||
|
S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Response" title="type actix_web::dev::ServiceFactory::Response">Response</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="dev/struct.Response.html" title="struct actix_web::dev::Response">Response</a><B>> + 'static,
|
|||
|
<S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Service" title="type actix_web::dev::ServiceFactory::Service">Service</a> as <a class="trait" href="dev/trait.Service.html" title="trait actix_web::dev::Service">Service</a><<a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>>>::<a class="associatedtype" href="dev/trait.Service.html#associatedtype.Future" title="type actix_web::dev::Service::Future">Future</a>: 'static,
|
|||
|
S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Service" title="type actix_web::dev::ServiceFactory::Service">Service</a>: 'static,
|
|||
|
B: <a class="trait" href="body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a> + 'static,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#114-130">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>(factory: F) -> Self</h4></section></summary><div class="docblock"><p>Create new HTTP server with application factory</p>
|
|||
|
<h5 id="worker-count"><a class="doc-anchor" href="#worker-count">§</a>Worker Count</h5>
|
|||
|
<p>The <code>factory</code> will be instantiated multiple times in most configurations. See
|
|||
|
<a href="struct.HttpServer.html#method.bind" title="method actix_web::HttpServer::bind"><code>bind()</code></a> docs for more on how worker count and bind address resolution
|
|||
|
causes multiple server factory instantiations.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.workers" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#146-149">source</a><h4 class="code-header">pub fn <a href="#method.workers" class="fn">workers</a>(self, num: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> Self</h4></section></summary><div class="docblock"><p>Sets number of workers to start (per bind address).</p>
|
|||
|
<p>The default worker count is the determined by <a href="https://doc.rust-lang.org/nightly/std/thread/fn.available_parallelism.html" title="fn std::thread::available_parallelism"><code>std::thread::available_parallelism()</code></a>. See
|
|||
|
its documentation to determine what behavior you should expect when server is run.</p>
|
|||
|
<p>Note that the server factory passed to <a href="struct.HttpServer.html#method.new" title="associated function actix_web::HttpServer::new"><code>new</code></a> will be instantiated <strong>at least
|
|||
|
once per worker</strong>. See <a href="struct.HttpServer.html#method.bind" title="method actix_web::HttpServer::bind"><code>bind()</code></a> docs for more on how worker count and bind
|
|||
|
address resolution causes multiple server factory instantiations.</p>
|
|||
|
<p><code>num</code> must be greater than 0.</p>
|
|||
|
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
|
|||
|
<p>Panics if <code>num</code> is 0.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.keep_alive" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#154-157">source</a><h4 class="code-header">pub fn <a href="#method.keep_alive" class="fn">keep_alive</a><T: <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="http/enum.KeepAlive.html" title="enum actix_web::http::KeepAlive">KeepAlive</a>>>(self, val: T) -> Self</h4></section></summary><div class="docblock"><p>Sets server keep-alive preference.</p>
|
|||
|
<p>By default keep-alive is set to 5 seconds.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.backlog" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#168-172">source</a><h4 class="code-header">pub fn <a href="#method.backlog" class="fn">backlog</a>(self, backlog: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> Self</h4></section></summary><div class="docblock"><p>Sets the maximum number of pending connections.</p>
|
|||
|
<p>This refers to the number of clients that can be waiting to be served. Exceeding this number
|
|||
|
results in the client getting an error when attempting to connect. It should only affect
|
|||
|
servers under significant load.</p>
|
|||
|
<p>Generally set in the 64–2048 range. Default value is 2048.</p>
|
|||
|
<p>This method will have no effect if called after a <code>bind()</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.max_connections" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#180-183">source</a><h4 class="code-header">pub fn <a href="#method.max_connections" class="fn">max_connections</a>(self, num: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> Self</h4></section></summary><div class="docblock"><p>Sets the per-worker maximum number of concurrent connections.</p>
|
|||
|
<p>All socket listeners will stop accepting connections when this limit is reached for
|
|||
|
each worker.</p>
|
|||
|
<p>By default max connections is set to a 25k.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.max_connection_rate" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#192-196">source</a><h4 class="code-header">pub fn <a href="#method.max_connection_rate" class="fn">max_connection_rate</a>(self, num: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> Self</h4></section></summary><div class="docblock"><p>Sets the per-worker maximum concurrent TLS connection limit.</p>
|
|||
|
<p>All listeners will stop accepting connections when this limit is reached. It can be used to
|
|||
|
limit the global TLS CPU usage.</p>
|
|||
|
<p>By default max connections is set to a 256.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.worker_max_blocking_threads" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#203-206">source</a><h4 class="code-header">pub fn <a href="#method.worker_max_blocking_threads" class="fn">worker_max_blocking_threads</a>(self, num: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> Self</h4></section></summary><div class="docblock"><p>Sets max number of threads for each worker’s blocking task thread pool.</p>
|
|||
|
<p>One thread pool is set up <strong>per worker</strong>; not shared across workers.</p>
|
|||
|
<p>By default set to 512 divided by the number of workers.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.client_request_timeout" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#216-219">source</a><h4 class="code-header">pub fn <a href="#method.client_request_timeout" class="fn">client_request_timeout</a>(self, dur: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> Self</h4></section></summary><div class="docblock"><p>Sets server client timeout for first request.</p>
|
|||
|
<p>Defines a timeout for reading client request head. If a client does not transmit the entire
|
|||
|
set headers within this time, the request is terminated with a 408 (Request Timeout) error.</p>
|
|||
|
<p>To disable timeout set value to 0.</p>
|
|||
|
<p>By default client timeout is set to 5000 milliseconds.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.client_disconnect_timeout" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#235-238">source</a><h4 class="code-header">pub fn <a href="#method.client_disconnect_timeout" class="fn">client_disconnect_timeout</a>(self, dur: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> Self</h4></section></summary><div class="docblock"><p>Sets server connection shutdown timeout.</p>
|
|||
|
<p>Defines a timeout for connection shutdown. If a shutdown procedure does not complete within
|
|||
|
this time, the request is dropped.</p>
|
|||
|
<p>To disable timeout set value to 0.</p>
|
|||
|
<p>By default client timeout is set to 5000 milliseconds.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.tls_handshake_timeout" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#253-261">source</a><h4 class="code-header">pub fn <a href="#method.tls_handshake_timeout" class="fn">tls_handshake_timeout</a>(self, dur: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> Self</h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate features <code>openssl</code> or <code>rustls-0_20</code> or <code>rustls-0_21</code> or <code>rustls-0_22</code> or <code>rustls-0_23</code></strong> only.</div></span></summary><div class="docblock"><p>Sets TLS handshake timeout.</p>
|
|||
|
<p>Defines a timeout for TLS handshake. If the TLS handshake does not complete within this
|
|||
|
time, the connection is closed.</p>
|
|||
|
<p>By default, the handshake timeout is 3 seconds.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.on_connect" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#287-300">source</a><h4 class="code-header">pub fn <a href="#method.on_connect" class="fn">on_connect</a><CB>(self, f: CB) -> <a class="struct" href="struct.HttpServer.html" title="struct actix_web::HttpServer">HttpServer</a><F, I, S, B><div class="where">where
|
|||
|
CB: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(&dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a>, &mut <a class="struct" href="dev/struct.Extensions.html" title="struct actix_web::dev::Extensions">Extensions</a>) + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,</div></h4></section></summary><div class="docblock"><p>Sets function that will be called once before each connection is handled.</p>
|
|||
|
<p>It will receive a <code>&std::any::Any</code>, which contains underlying connection type and an
|
|||
|
<a href="dev/struct.Extensions.html" title="struct actix_web::dev::Extensions">Extensions</a> container so that connection data can be accessed in middleware and handlers.</p>
|
|||
|
<h5 id="connection-types"><a class="doc-anchor" href="#connection-types">§</a>Connection Types</h5>
|
|||
|
<ul>
|
|||
|
<li><code>actix_tls::accept::openssl::TlsStream<actix_web::rt::net::TcpStream></code> when using OpenSSL.</li>
|
|||
|
<li><code>actix_tls::accept::rustls_0_20::TlsStream<actix_web::rt::net::TcpStream></code> when using
|
|||
|
Rustls v0.20.</li>
|
|||
|
<li><code>actix_tls::accept::rustls_0_21::TlsStream<actix_web::rt::net::TcpStream></code> when using
|
|||
|
Rustls v0.21.</li>
|
|||
|
<li><code>actix_tls::accept::rustls_0_22::TlsStream<actix_web::rt::net::TcpStream></code> when using
|
|||
|
Rustls v0.22.</li>
|
|||
|
<li><code>actix_tls::accept::rustls_0_23::TlsStream<actix_web::rt::net::TcpStream></code> when using
|
|||
|
Rustls v0.23.</li>
|
|||
|
<li><code>actix_web::rt::net::TcpStream</code> when no encryption is used.</li>
|
|||
|
</ul>
|
|||
|
<p>See the <code>on_connect</code> example for additional details.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.server_hostname" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#308-311">source</a><h4 class="code-header">pub fn <a href="#method.server_hostname" class="fn">server_hostname</a><T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>>(self, val: T) -> Self</h4></section></summary><div class="docblock"><p>Sets server host name.</p>
|
|||
|
<p>Host name is used by application router as a hostname for url generation. Check
|
|||
|
<a href="dev/struct.ConnectionInfo.html#method.host" title="method actix_web::dev::ConnectionInfo::host"><code>ConnectionInfo</code></a> docs for more info.</p>
|
|||
|
<p>By default, hostname is set to “localhost”.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.system_exit" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#316-319">source</a><h4 class="code-header">pub fn <a href="#method.system_exit" class="fn">system_exit</a>(self) -> Self</h4></section></summary><div class="docblock"><p>Flags the <code>System</code> to exit after server shutdown.</p>
|
|||
|
<p>Does nothing when running under <code>#[tokio::main]</code> runtime.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.disable_signals" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#322-325">source</a><h4 class="code-header">pub fn <a href="#method.disable_signals" class="fn">disable_signals</a>(self) -> Self</h4></section></summary><div class="docblock"><p>Disables signal handling.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.shutdown_timeout" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#333-336">source</a><h4 class="code-header">pub fn <a href="#method.shutdown_timeout" class="fn">shutdown_timeout</a>(self, sec: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -> Self</h4></section></summary><div class="docblock"><p>Sets timeout for graceful worker shutdown of workers.</p>
|
|||
|
<p>After receiving a stop signal, workers have this much time to finish serving requests.
|
|||
|
Workers still alive after the timeout are force dropped.</p>
|
|||
|
<p>By default shutdown timeout sets to 30 seconds.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.addrs" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#339-341">source</a><h4 class="code-header">pub fn <a href="#method.addrs" class="fn">addrs</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>></h4></section></summary><div class="docblock"><p>Returns addresses of bound sockets.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.addrs_with_scheme" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#348-350">source</a><h4 class="code-header">pub fn <a href="#method.addrs_with_scheme" class="fn">addrs_with_scheme</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><(<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>, &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>)></h4></section></summary><div class="docblock"><p>Returns addresses of bound sockets and the scheme for it.</p>
|
|||
|
<p>This is useful when the server is bound from different sources with some sockets listening
|
|||
|
on HTTP and some listening on HTTPS and the user should be presented with an enumeration of
|
|||
|
which socket requires which protocol.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.bind" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#398-406">source</a><h4 class="code-header">pub fn <a href="#method.bind" class="fn">bind</a><A: <a class="trait" href="https://doc.rust-lang.org/nightly/std/net/socket_addr/trait.ToSocketAddrs.html" title="trait std::net::socket_addr::ToSocketAddrs">ToSocketAddrs</a>>(self, addrs: A) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section></summary><div class="docblock"><p>Resolves socket address(es) and binds server to created listener(s).</p>
|
|||
|
<h5 id="hostname-resolution"><a class="doc-anchor" href="#hostname-resolution">§</a>Hostname Resolution</h5>
|
|||
|
<p>When <code>addrs</code> includes a hostname, it is possible for this method to bind to both the IPv4
|
|||
|
and IPv6 addresses that result from a DNS lookup. You can test this by passing
|
|||
|
<code>localhost:8080</code> and noting that the server binds to <code>127.0.0.1:8080</code> <em>and</em> <code>[::1]:8080</code>. To
|
|||
|
bind additional addresses, call this method multiple times.</p>
|
|||
|
<p>Note that, if a DNS lookup is required, resolving hostnames is a blocking operation.</p>
|
|||
|
<h5 id="worker-count-1"><a class="doc-anchor" href="#worker-count-1">§</a>Worker Count</h5>
|
|||
|
<p>The <code>factory</code> will be instantiated multiple times in most scenarios. The number of
|
|||
|
instantiations is number of <a href="struct.HttpServer.html#method.workers" title="method actix_web::HttpServer::workers"><code>workers</code></a> × number of sockets resolved by
|
|||
|
<code>addrs</code>.</p>
|
|||
|
<p>For example, if you’ve manually set <a href="struct.HttpServer.html#method.workers" title="method actix_web::HttpServer::workers"><code>workers</code></a> to 2, and use <code>127.0.0.1</code>
|
|||
|
as the bind <code>addrs</code>, then <code>factory</code> will be instantiated twice. However, using <code>localhost</code>
|
|||
|
as the bind <code>addrs</code> can often resolve to both <code>127.0.0.1</code> (IPv4) <em>and</em> <code>::1</code> (IPv6), causing
|
|||
|
the <code>factory</code> to be instantiated 4 times (2 workers × 2 bind addresses).</p>
|
|||
|
<p>Using a bind address of <code>0.0.0.0</code>, which signals to use all interfaces, may also multiple
|
|||
|
the number of instantiations in a similar way.</p>
|
|||
|
<h5 id="typical-usage"><a class="doc-anchor" href="#typical-usage">§</a>Typical Usage</h5>
|
|||
|
<p>In general, use <code>127.0.0.1:<port></code> when testing locally and <code>0.0.0.0:<port></code> when deploying
|
|||
|
(with or without a reverse proxy or load balancer) so that the server is accessible.</p>
|
|||
|
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
|
|||
|
<p>Returns an <code>io::Error</code> if:</p>
|
|||
|
<ul>
|
|||
|
<li><code>addrs</code> cannot be resolved into one or more socket addresses;</li>
|
|||
|
<li>all the resolved socket addresses are already bound.</li>
|
|||
|
</ul>
|
|||
|
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>HttpServer::new(|| App::new())
|
|||
|
.bind((<span class="string">"127.0.0.1"</span>, <span class="number">8080</span>))<span class="question-mark">?
|
|||
|
</span>.bind(<span class="string">"[::1]:9000"</span>)<span class="question-mark">?</span></code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.bind_auto_h2c" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#413-421">source</a><h4 class="code-header">pub fn <a href="#method.bind_auto_h2c" class="fn">bind_auto_h2c</a><A: <a class="trait" href="https://doc.rust-lang.org/nightly/std/net/socket_addr/trait.ToSocketAddrs.html" title="trait std::net::socket_addr::ToSocketAddrs">ToSocketAddrs</a>>(self, addrs: A) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>http2</code></strong> only.</div></span></summary><div class="docblock"><p>Resolves socket address(es) and binds server to created listener(s) for plaintext HTTP/1.x
|
|||
|
or HTTP/2 connections.</p>
|
|||
|
<p>See <a href="struct.HttpServer.html#method.bind" title="method actix_web::HttpServer::bind"><code>bind()</code></a> for more details on <code>addrs</code> argument.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.bind_rustls" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#430-440">source</a><h4 class="code-header">pub fn <a href="#method.bind_rustls" class="fn">bind_rustls</a><A: <a class="trait" href="https://doc.rust-lang.org/nightly/std/net/socket_addr/trait.ToSocketAddrs.html" title="trait std::net::socket_addr::ToSocketAddrs">ToSocketAddrs</a>>(
|
|||
|
self,
|
|||
|
addrs: A,
|
|||
|
config: ServerConfig
|
|||
|
) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>rustls-0_20</code></strong> only.</div></span></summary><div class="docblock"><p>Resolves socket address(es) and binds server to created listener(s) for TLS connections
|
|||
|
using Rustls v0.20.</p>
|
|||
|
<p>See <a href="struct.HttpServer.html#method.bind" title="method actix_web::HttpServer::bind"><code>bind()</code></a> for more details on <code>addrs</code> argument.</p>
|
|||
|
<p>ALPN protocols “h2” and “http/1.1” are added to any configured ones.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.bind_rustls_021" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#449-459">source</a><h4 class="code-header">pub fn <a href="#method.bind_rustls_021" class="fn">bind_rustls_021</a><A: <a class="trait" href="https://doc.rust-lang.org/nightly/std/net/socket_addr/trait.ToSocketAddrs.html" title="trait std::net::socket_addr::ToSocketAddrs">ToSocketAddrs</a>>(
|
|||
|
self,
|
|||
|
addrs: A,
|
|||
|
config: ServerConfig
|
|||
|
) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>rustls-0_21</code></strong> only.</div></span></summary><div class="docblock"><p>Resolves socket address(es) and binds server to created listener(s) for TLS connections
|
|||
|
using Rustls v0.21.</p>
|
|||
|
<p>See <a href="struct.HttpServer.html#method.bind" title="method actix_web::HttpServer::bind"><code>bind()</code></a> for more details on <code>addrs</code> argument.</p>
|
|||
|
<p>ALPN protocols “h2” and “http/1.1” are added to any configured ones.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.bind_rustls_0_22" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#468-478">source</a><h4 class="code-header">pub fn <a href="#method.bind_rustls_0_22" class="fn">bind_rustls_0_22</a><A: <a class="trait" href="https://doc.rust-lang.org/nightly/std/net/socket_addr/trait.ToSocketAddrs.html" title="trait std::net::socket_addr::ToSocketAddrs">ToSocketAddrs</a>>(
|
|||
|
self,
|
|||
|
addrs: A,
|
|||
|
config: ServerConfig
|
|||
|
) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>rustls-0_22</code></strong> only.</div></span></summary><div class="docblock"><p>Resolves socket address(es) and binds server to created listener(s) for TLS connections
|
|||
|
using Rustls v0.22.</p>
|
|||
|
<p>See <a href="struct.HttpServer.html#method.bind" title="method actix_web::HttpServer::bind"><code>bind()</code></a> for more details on <code>addrs</code> argument.</p>
|
|||
|
<p>ALPN protocols “h2” and “http/1.1” are added to any configured ones.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.bind_rustls_0_23" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#487-497">source</a><h4 class="code-header">pub fn <a href="#method.bind_rustls_0_23" class="fn">bind_rustls_0_23</a><A: <a class="trait" href="https://doc.rust-lang.org/nightly/std/net/socket_addr/trait.ToSocketAddrs.html" title="trait std::net::socket_addr::ToSocketAddrs">ToSocketAddrs</a>>(
|
|||
|
self,
|
|||
|
addrs: A,
|
|||
|
config: ServerConfig
|
|||
|
) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>rustls-0_23</code></strong> only.</div></span></summary><div class="docblock"><p>Resolves socket address(es) and binds server to created listener(s) for TLS connections
|
|||
|
using Rustls v0.23.</p>
|
|||
|
<p>See <a href="struct.HttpServer.html#method.bind" title="method actix_web::HttpServer::bind"><code>bind()</code></a> for more details on <code>addrs</code> argument.</p>
|
|||
|
<p>ALPN protocols “h2” and “http/1.1” are added to any configured ones.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.bind_openssl" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#506-518">source</a><h4 class="code-header">pub fn <a href="#method.bind_openssl" class="fn">bind_openssl</a><A>(
|
|||
|
self,
|
|||
|
addrs: A,
|
|||
|
builder: <a class="struct" href="https://docs.rs/openssl/0.10/openssl/ssl/connector/struct.SslAcceptorBuilder.html" title="struct openssl::ssl::connector::SslAcceptorBuilder">SslAcceptorBuilder</a>
|
|||
|
) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self><div class="where">where
|
|||
|
A: <a class="trait" href="https://doc.rust-lang.org/nightly/std/net/socket_addr/trait.ToSocketAddrs.html" title="trait std::net::socket_addr::ToSocketAddrs">ToSocketAddrs</a>,</div></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>openssl</code></strong> only.</div></span></summary><div class="docblock"><p>Resolves socket address(es) and binds server to created listener(s) for TLS connections
|
|||
|
using OpenSSL.</p>
|
|||
|
<p>See <a href="struct.HttpServer.html#method.bind" title="method actix_web::HttpServer::bind"><code>bind()</code></a> for more details on <code>addrs</code> argument.</p>
|
|||
|
<p>ALPN protocols “h2” and “http/1.1” are added to any configured ones.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.listen" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#524-564">source</a><h4 class="code-header">pub fn <a href="#method.listen" class="fn">listen</a>(self, lst: <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section></summary><div class="docblock"><p>Binds to existing listener for accepting incoming connection requests.</p>
|
|||
|
<p>No changes are made to <code>lst</code>’s configuration. Ensure it is configured properly before
|
|||
|
passing ownership to <code>listen()</code>.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.listen_auto_h2c" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#568-608">source</a><h4 class="code-header">pub fn <a href="#method.listen_auto_h2c" class="fn">listen_auto_h2c</a>(self, lst: <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>http2</code></strong> only.</div></span></summary><div class="docblock"><p>Binds to existing listener for accepting incoming plaintext HTTP/1.x or HTTP/2 connections.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.listen_rustls" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#617-623">source</a><h4 class="code-header">pub fn <a href="#method.listen_rustls" class="fn">listen_rustls</a>(
|
|||
|
self,
|
|||
|
lst: <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a>,
|
|||
|
config: ServerConfig
|
|||
|
) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>rustls-0_20</code></strong> only.</div></span></summary><div class="docblock"><p>Binds to existing listener for accepting incoming TLS connection requests using Rustls
|
|||
|
v0.20.</p>
|
|||
|
<p>See <a href="struct.HttpServer.html#method.listen" title="method actix_web::HttpServer::listen"><code>listen()</code></a> for more details on the <code>lst</code> argument.</p>
|
|||
|
<p>ALPN protocols “h2” and “http/1.1” are added to any configured ones.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.listen_rustls_0_21" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#632-638">source</a><h4 class="code-header">pub fn <a href="#method.listen_rustls_0_21" class="fn">listen_rustls_0_21</a>(
|
|||
|
self,
|
|||
|
lst: <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a>,
|
|||
|
config: ServerConfig
|
|||
|
) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>rustls-0_21</code></strong> only.</div></span></summary><div class="docblock"><p>Binds to existing listener for accepting incoming TLS connection requests using Rustls
|
|||
|
v0.21.</p>
|
|||
|
<p>See <a href="struct.HttpServer.html#method.listen" title="method actix_web::HttpServer::listen"><code>listen()</code></a> for more details on the <code>lst</code> argument.</p>
|
|||
|
<p>ALPN protocols “h2” and “http/1.1” are added to any configured ones.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.listen_rustls_0_22" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#749-755">source</a><h4 class="code-header">pub fn <a href="#method.listen_rustls_0_22" class="fn">listen_rustls_0_22</a>(
|
|||
|
self,
|
|||
|
lst: <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a>,
|
|||
|
config: ServerConfig
|
|||
|
) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>rustls-0_22</code></strong> only.</div></span></summary><div class="docblock"><p>Binds to existing listener for accepting incoming TLS connection requests using Rustls
|
|||
|
v0.22.</p>
|
|||
|
<p>See <a href="struct.HttpServer.html#method.listen" title="method actix_web::HttpServer::listen"><code>listen()</code></a> for more details on the <code>lst</code> argument.</p>
|
|||
|
<p>ALPN protocols “h2” and “http/1.1” are added to any configured ones.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.listen_rustls_0_23" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#815-821">source</a><h4 class="code-header">pub fn <a href="#method.listen_rustls_0_23" class="fn">listen_rustls_0_23</a>(
|
|||
|
self,
|
|||
|
lst: <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a>,
|
|||
|
config: ServerConfig
|
|||
|
) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>rustls-0_23</code></strong> only.</div></span></summary><div class="docblock"><p>Binds to existing listener for accepting incoming TLS connection requests using Rustls
|
|||
|
v0.23.</p>
|
|||
|
<p>See <a href="struct.HttpServer.html#method.listen" title="method actix_web::HttpServer::listen"><code>listen()</code></a> for more details on the <code>lst</code> argument.</p>
|
|||
|
<p>ALPN protocols “h2” and “http/1.1” are added to any configured ones.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.listen_openssl" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#880-886">source</a><h4 class="code-header">pub fn <a href="#method.listen_openssl" class="fn">listen_openssl</a>(
|
|||
|
self,
|
|||
|
lst: <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a>,
|
|||
|
builder: <a class="struct" href="https://docs.rs/openssl/0.10/openssl/ssl/connector/struct.SslAcceptorBuilder.html" title="struct openssl::ssl::connector::SslAcceptorBuilder">SslAcceptorBuilder</a>
|
|||
|
) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>openssl</code></strong> only.</div></span></summary><div class="docblock"><p>Binds to existing listener for accepting incoming TLS connection requests using OpenSSL.</p>
|
|||
|
<p>See <a href="struct.HttpServer.html#method.listen" title="method actix_web::HttpServer::listen"><code>listen()</code></a> for more details on the <code>lst</code> argument.</p>
|
|||
|
<p>ALPN protocols “h2” and “http/1.1” are added to any configured ones.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.bind_uds" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#944-988">source</a><h4 class="code-header">pub fn <a href="#method.bind_uds" class="fn">bind_uds</a><A>(self, uds_path: A) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self><div class="where">where
|
|||
|
A: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>,</div></h4></section><span class="item-info"><div class="stab portability">Available on <strong>Unix</strong> only.</div></span></summary><div class="docblock"><p>Opens Unix Domain Socket (UDS) from <code>uds</code> path and binds server to created listener.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.listen_uds" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#992-1036">source</a><h4 class="code-header">pub fn <a href="#method.listen_uds" class="fn">listen_uds</a>(self, lst: <a class="struct" href="https://doc.rust-lang.org/nightly/std/os/unix/net/listener/struct.UnixListener.html" title="struct std::os::unix::net::listener::UnixListener">UnixListener</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><Self></h4></section><span class="item-info"><div class="stab portability">Available on <strong>Unix</strong> only.</div></span></summary><div class="docblock"><p>Binds to existing Unix Domain Socket (UDS) listener.</p>
|
|||
|
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-HttpServer%3CF,+I,+S,+B%3E-1" class="impl"><a class="src rightside" href="../src/actix_web/server.rs.html#1039-1065">source</a><a href="#impl-HttpServer%3CF,+I,+S,+B%3E-1" class="anchor">§</a><h3 class="code-header">impl<F, I, S, B> <a class="struct" href="struct.HttpServer.html" title="struct actix_web::HttpServer">HttpServer</a><F, I, S, B><div class="where">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>() -> I + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + 'static,
|
|||
|
I: IntoServiceFactory<S, <a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>>,
|
|||
|
S: <a class="trait" href="dev/trait.ServiceFactory.html" title="trait actix_web::dev::ServiceFactory">ServiceFactory</a><<a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>, Config = <a class="struct" href="dev/struct.AppConfig.html" title="struct actix_web::dev::AppConfig">AppConfig</a>>,
|
|||
|
S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Error" title="type actix_web::dev::ServiceFactory::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="error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>,
|
|||
|
S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.InitError" title="type actix_web::dev::ServiceFactory::InitError">InitError</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,
|
|||
|
S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Response" title="type actix_web::dev::ServiceFactory::Response">Response</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="dev/struct.Response.html" title="struct actix_web::dev::Response">Response</a><B>>,
|
|||
|
S::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Service" title="type actix_web::dev::ServiceFactory::Service">Service</a>: 'static,
|
|||
|
B: <a class="trait" href="body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.run" class="method"><a class="src rightside" href="../src/actix_web/server.rs.html#1062-1064">source</a><h4 class="code-header">pub fn <a href="#method.run" class="fn">run</a>(self) -> <a class="struct" href="dev/struct.Server.html" title="struct actix_web::dev::Server">Server</a> <a href="#" class="tooltip" data-notable-ty="Server">ⓘ</a></h4></section></summary><div class="docblock"><p>Start listening for incoming connections.</p>
|
|||
|
<h5 id="workers"><a class="doc-anchor" href="#workers">§</a>Workers</h5>
|
|||
|
<p>This method starts a number of HTTP workers in separate threads. The number of workers in a
|
|||
|
set is defined by <a href="struct.HttpServer.html#method.workers" title="method actix_web::HttpServer::workers"><code>workers()</code></a> or, by default, the number of the machine’s
|
|||
|
physical cores. One worker set is created for each socket address to be bound. For example,
|
|||
|
if workers is set to 4, and there are 2 addresses to bind, then 8 worker threads will be
|
|||
|
spawned.</p>
|
|||
|
<h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5>
|
|||
|
<p>This methods panics if no socket addresses were successfully bound or if no Tokio runtime
|
|||
|
is set up.</p>
|
|||
|
</div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-HttpServer%3CF,+I,+S,+B%3E" class="impl"><a href="#impl-Freeze-for-HttpServer%3CF,+I,+S,+B%3E" class="anchor">§</a><h3 class="code-header">impl<F, I, S, B> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.HttpServer.html" title="struct actix_web::HttpServer">HttpServer</a><F, I, S, B><div class="where">where
|
|||
|
<S as <a class="trait" href="dev/trait.ServiceFactory.html" title="trait actix_web::dev::ServiceFactory">ServiceFactory</a><<a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>>>::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Response" title="type actix_web::dev::ServiceFactory::Response">Response</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
<S as <a class="trait" href="dev/trait.ServiceFactory.html" title="trait actix_web::dev::ServiceFactory">ServiceFactory</a><<a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>>>::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Error" title="type actix_web::dev::ServiceFactory::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a>,</div></h3></section><section id="impl-RefUnwindSafe-for-HttpServer%3CF,+I,+S,+B%3E" class="impl"><a href="#impl-RefUnwindSafe-for-HttpServer%3CF,+I,+S,+B%3E" class="anchor">§</a><h3 class="code-header">impl<F, I, S, B> !<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.HttpServer.html" title="struct actix_web::HttpServer">HttpServer</a><F, I, S, B></h3></section><section id="impl-Send-for-HttpServer%3CF,+I,+S,+B%3E" class="impl"><a href="#impl-Send-for-HttpServer%3CF,+I,+S,+B%3E" class="anchor">§</a><h3 class="code-header">impl<F, I, S, B> <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.HttpServer.html" title="struct actix_web::HttpServer">HttpServer</a><F, I, S, B><div class="where">where
|
|||
|
<S as <a class="trait" href="dev/trait.ServiceFactory.html" title="trait actix_web::dev::ServiceFactory">ServiceFactory</a><<a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>>>::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Response" title="type actix_web::dev::ServiceFactory::Response">Response</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
<S as <a class="trait" href="dev/trait.ServiceFactory.html" title="trait actix_web::dev::ServiceFactory">ServiceFactory</a><<a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>>>::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Error" title="type actix_web::dev::ServiceFactory::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,
|
|||
|
B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section><section id="impl-Sync-for-HttpServer%3CF,+I,+S,+B%3E" class="impl"><a href="#impl-Sync-for-HttpServer%3CF,+I,+S,+B%3E" class="anchor">§</a><h3 class="code-header">impl<F, I, S, B> !<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.HttpServer.html" title="struct actix_web::HttpServer">HttpServer</a><F, I, S, B></h3></section><section id="impl-Unpin-for-HttpServer%3CF,+I,+S,+B%3E" class="impl"><a href="#impl-Unpin-for-HttpServer%3CF,+I,+S,+B%3E" class="anchor">§</a><h3 class="code-header">impl<F, I, S, B> <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.HttpServer.html" title="struct actix_web::HttpServer">HttpServer</a><F, I, S, B><div class="where">where
|
|||
|
<S as <a class="trait" href="dev/trait.ServiceFactory.html" title="trait actix_web::dev::ServiceFactory">ServiceFactory</a><<a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>>>::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Response" title="type actix_web::dev::ServiceFactory::Response">Response</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
<S as <a class="trait" href="dev/trait.ServiceFactory.html" title="trait actix_web::dev::ServiceFactory">ServiceFactory</a><<a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a>>>::<a class="associatedtype" href="dev/trait.ServiceFactory.html#associatedtype.Error" title="type actix_web::dev::ServiceFactory::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,
|
|||
|
B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section><section id="impl-UnwindSafe-for-HttpServer%3CF,+I,+S,+B%3E" class="impl"><a href="#impl-UnwindSafe-for-HttpServer%3CF,+I,+S,+B%3E" class="anchor">§</a><h3 class="code-header">impl<F, I, S, B> !<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.HttpServer.html" title="struct actix_web::HttpServer">HttpServer</a><F, I, S, B></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
|||
|
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
|||
|
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#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-T" 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-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
|||
|
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#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-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#765">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#768">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-T" class="impl"><a href="#impl-Instrument-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Instrument for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.instrument" class="method trait-impl"><a href="#method.instrument" class="anchor">§</a><h4 class="code-header">fn <a class="fn">instrument</a>(self, span: Span) -> Instrumented<Self></h4></section></summary><div class='docblock'>Instruments this type with the provided [<code>Span</code>], returning an
|
|||
|
<code>Instrumented</code> wrapper. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.in_current_span" class="method trait-impl"><a href="#method.in_current_span" class="anchor">§</a><h4 class="code-header">fn <a class="fn">in_current_span</a>(self) -> Instrumented<Self></h4></section></summary><div class='docblock'>Instruments this type with the <a href="super::Span::current()">current</a> <a href="crate::Span"><code>Span</code></a>, returning an
|
|||
|
<code>Instrumented</code> wrapper. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#748-750">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
|||
|
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#758">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-for-T" 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-for-T" 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> 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-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#805-807">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
|||
|
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#812">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#790-792">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
|||
|
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#797">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-VZip%3CV%3E-for-T" class="impl"><a href="#impl-VZip%3CV%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<V, T> VZip<V> for T<div class="where">where
|
|||
|
V: MultiLane<T>,</div></h3></section></summary><div class="impl-items"><section id="method.vzip" class="method trait-impl"><a href="#method.vzip" class="anchor">§</a><h4 class="code-header">fn <a class="fn">vzip</a>(self) -> V</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-WithSubscriber-for-T" class="impl"><a href="#impl-WithSubscriber-for-T" class="anchor">§</a><h3 class="code-header">impl<T> WithSubscriber for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_subscriber" class="method trait-impl"><a href="#method.with_subscriber" class="anchor">§</a><h4 class="code-header">fn <a class="fn">with_subscriber</a><S>(self, subscriber: S) -> WithDispatch<Self><div class="where">where
|
|||
|
S: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><Dispatch>,</div></h4></section></summary><div class='docblock'>Attaches the provided <a href="super::Subscriber"><code>Subscriber</code></a> to this type, returning a
|
|||
|
[<code>WithDispatch</code>] wrapper. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.with_current_subscriber" class="method trait-impl"><a href="#method.with_current_subscriber" class="anchor">§</a><h4 class="code-header">fn <a class="fn">with_current_subscriber</a>(self) -> WithDispatch<Self></h4></section></summary><div class='docblock'>Attaches the current <a href="crate::dispatcher#setting-the-default-subscriber">default</a> <a href="super::Subscriber"><code>Subscriber</code></a> to this type, returning a
|
|||
|
[<code>WithDispatch</code>] wrapper. <a>Read more</a></div></details></div></details></div><script type="text/json" id="notable-traits-data">{"Server":"<h3>Notable traits for <code><a class=\"struct\" href=\"dev/struct.Server.html\" title=\"struct actix_web::dev::Server\">Server</a></code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"dev/struct.Server.html\" title=\"struct actix_web::dev::Server\">Server</a></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <a class=\"enum\" href=\"https://doc.rust-lang.org/nightly/core/result/enum.Result.html\" title=\"enum core::result::Result\">Result</a><<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.unit.html\">()</a>, <a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html\" title=\"struct std::io::error::Error\">Error</a>>;</div>"}</script></section></div></main></body></html>
|