mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 17:52:56 +01:00
131 lines
55 KiB
HTML
131 lines
55 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="Static files handling service."><title>Files in actix_files - 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_files" 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_files/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_files/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_files/index.html">actix_files</a><span class="version">0.6.5</span></h2></div><h2 class="location"><a href="#">Files</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.default_handler">default_handler</a></li><li><a href="#method.disable_content_disposition">disable_content_disposition</a></li><li><a href="#method.files_listing_renderer">files_listing_renderer</a></li><li><a href="#method.guard">guard</a></li><li><a href="#method.index_file">index_file</a></li><li><a href="#method.method_guard">method_guard</a></li><li><a href="#method.mime_override">mime_override</a></li><li><a href="#method.new">new</a></li><li><a href="#method.path_filter">path_filter</a></li><li><a href="#method.prefer_utf8">prefer_utf8</a></li><li><a href="#method.redirect_to_slash_directory">redirect_to_slash_directory</a></li><li><a href="#method.show_files_listing">show_files_listing</a></li><li><a href="#method.use_etag">use_etag</a></li><li><a href="#method.use_hidden_files">use_hidden_files</a></li><li><a href="#method.use_last_modified">use_last_modified</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Clone-for-Files">Clone</a></li><li><a href="#impl-Debug-for-Files">Debug</a></li><li><a href="#impl-HttpServiceFactory-for-Files">HttpServiceFactory</a></li><li><a href="#impl-ServiceFactory%3CServiceRequest%3E-for-Files">ServiceFactory<ServiceRequest></a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-Files">!RefUnwindSafe</a></li><li><a href="#impl-Send-for-Files">!Send</a></li><li><a href="#impl-Sync-for-Files">!Sync</a></li><li><a href="#impl-UnwindSafe-for-Files">!UnwindSafe</a></li><li><a href="#impl-Freeze-for-Files">Freeze</a></li><li><a href="#impl-Unpin-for-Files">Unpin</
|
|||
|
<p><code>Files</code> service must be registered with <code>App::service()</code> method.</p>
|
|||
|
<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::App;
|
|||
|
<span class="kw">use </span>actix_files::Files;
|
|||
|
|
|||
|
<span class="kw">let </span>app = App::new()
|
|||
|
.service(Files::new(<span class="string">"/static"</span>, <span class="string">"."</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-Files" class="impl"><a class="src rightside" href="../src/actix_files/files.rs.html#80-319">source</a><a href="#impl-Files" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Files.html" title="struct actix_files::Files">Files</a></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_files/files.rs.html#98-123">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</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="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>>>(mount_path: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, serve_from: T) -> <a class="struct" href="struct.Files.html" title="struct actix_files::Files">Files</a></h4></section></summary><div class="docblock"><p>Create new <code>Files</code> instance for a specified base directory.</p>
|
|||
|
<h5 id="argument-order"><a class="doc-anchor" href="#argument-order">§</a>Argument Order</h5>
|
|||
|
<p>The first argument (<code>mount_path</code>) is the root URL at which the static files are served.
|
|||
|
For example, <code>/assets</code> will serve files at <code>example.com/assets/...</code>.</p>
|
|||
|
<p>The second argument (<code>serve_from</code>) is the location on disk at which files are loaded.
|
|||
|
This can be a relative path. For example, <code>./</code> would serve files from the current
|
|||
|
working directory.</p>
|
|||
|
<h5 id="implementation-notes"><a class="doc-anchor" href="#implementation-notes">§</a>Implementation Notes</h5>
|
|||
|
<p>If the mount path is set as the root path <code>/</code>, services registered after this one will
|
|||
|
be inaccessible. Register more specific handlers and services first.</p>
|
|||
|
<p><code>Files</code> utilizes the existing Tokio thread-pool for blocking filesystem operations.
|
|||
|
The number of running threads is adjusted over time as needed, up to a maximum of 512 times
|
|||
|
the number of server <a href="actix_web::HttpServer::workers">workers</a>, by default.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.show_files_listing" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#131-134">source</a><h4 class="code-header">pub fn <a href="#method.show_files_listing" class="fn">show_files_listing</a>(self) -> Self</h4></section></summary><div class="docblock"><p>Show files listing for directories.</p>
|
|||
|
<p>By default show files listing is disabled.</p>
|
|||
|
<p>When used with <a href="struct.Files.html#method.index_file" title="method actix_files::Files::index_file"><code>Files::index_file()</code></a>, files listing is shown as a fallback
|
|||
|
when the index file is not found.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.redirect_to_slash_directory" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#139-142">source</a><h4 class="code-header">pub fn <a href="#method.redirect_to_slash_directory" class="fn">redirect_to_slash_directory</a>(self) -> Self</h4></section></summary><div class="docblock"><p>Redirects to a slash-ended path when browsing a directory.</p>
|
|||
|
<p>By default never redirect.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.files_listing_renderer" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#145-152">source</a><h4 class="code-header">pub fn <a href="#method.files_listing_renderer" class="fn">files_listing_renderer</a><F>(self, f: F) -> Self<div class="where">where
|
|||
|
for<'r, 's> 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>(&'r <a class="struct" href="struct.Directory.html" title="struct actix_files::Directory">Directory</a>, &'s HttpRequest) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><ServiceResponse, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>> + 'static,</div></h4></section></summary><div class="docblock"><p>Set custom directory renderer.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.mime_override" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#155-161">source</a><h4 class="code-header">pub fn <a href="#method.mime_override" class="fn">mime_override</a><F>(self, f: F) -> Self<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>(&<a class="struct" href="https://docs.rs/mime/0.3.17/mime/struct.Name.html" title="struct mime::Name">Name</a><'_>) -> DispositionType + 'static,</div></h4></section></summary><div class="docblock"><p>Specifies MIME override callback.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.path_filter" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#187-193">source</a><h4 class="code-header">pub fn <a href="#method.path_filter" class="fn">path_filter</a><F>(self, f: F) -> Self<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>(&<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>, &RequestHead) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> + 'static,</div></h4></section></summary><div class="docblock"><p>Sets path filtering closure.</p>
|
|||
|
<p>The path provided to the closure is relative to <code>serve_from</code> path.
|
|||
|
You can safely join this path with the <code>serve_from</code> path to get the real path.
|
|||
|
However, the real path may not exist since the filter is called before checking path existence.</p>
|
|||
|
<p>When a path doesn’t pass the filter, <a href="struct.Files.html#method.default_handler" title="method actix_files::Files::default_handler"><code>Files::default_handler</code></a> is called if set, otherwise,
|
|||
|
<code>404 Not Found</code> is returned.</p>
|
|||
|
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::path::Path;
|
|||
|
<span class="kw">use </span>actix_files::Files;
|
|||
|
|
|||
|
<span class="comment">// prevent searching subdirectories and following symlinks
|
|||
|
</span><span class="kw">let </span>files_service = Files::new(<span class="string">"/"</span>, <span class="string">"./static"</span>).path_filter(|path, <span class="kw">_</span>| {
|
|||
|
path.components().count() == <span class="number">1
|
|||
|
</span>&& Path::new(<span class="string">"./static"</span>)
|
|||
|
.join(path)
|
|||
|
.symlink_metadata()
|
|||
|
.map(|m| !m.file_type().is_symlink())
|
|||
|
.unwrap_or(<span class="bool-val">false</span>)
|
|||
|
});</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.index_file" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#202-205">source</a><h4 class="code-header">pub fn <a href="#method.index_file" class="fn">index_file</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="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>>(self, index: T) -> Self</h4></section></summary><div class="docblock"><p>Set index file</p>
|
|||
|
<p>Shows specific index file for directories instead of
|
|||
|
showing files listing.</p>
|
|||
|
<p>If the index file is not found, files listing is shown as a fallback if
|
|||
|
<a href="struct.Files.html#method.show_files_listing" title="method actix_files::Files::show_files_listing"><code>Files::show_files_listing()</code></a> is set.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.use_etag" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#210-213">source</a><h4 class="code-header">pub fn <a href="#method.use_etag" class="fn">use_etag</a>(self, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> Self</h4></section></summary><div class="docblock"><p>Specifies whether to use ETag or not.</p>
|
|||
|
<p>Default is true.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.use_last_modified" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#218-221">source</a><h4 class="code-header">pub fn <a href="#method.use_last_modified" class="fn">use_last_modified</a>(self, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> Self</h4></section></summary><div class="docblock"><p>Specifies whether to use Last-Modified or not.</p>
|
|||
|
<p>Default is true.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.prefer_utf8" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#226-229">source</a><h4 class="code-header">pub fn <a href="#method.prefer_utf8" class="fn">prefer_utf8</a>(self, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> Self</h4></section></summary><div class="docblock"><p>Specifies whether text responses should signal a UTF-8 encoding.</p>
|
|||
|
<p>Default is false (but will default to true in a future version).</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.guard" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#250-253">source</a><h4 class="code-header">pub fn <a href="#method.guard" class="fn">guard</a><G: Guard + 'static>(self, guard: G) -> Self</h4></section></summary><div class="docblock"><p>Adds a routing guard.</p>
|
|||
|
<p>Use this to allow multiple chained file services that respond to strictly different
|
|||
|
properties of a request. Due to the way routing works, if a guard check returns true and the
|
|||
|
request starts being handled by the file service, it will not be able to back-out and try
|
|||
|
the next service, you will simply get a 404 (or 405) error response.</p>
|
|||
|
<p>To allow <code>POST</code> requests to retrieve files, see <a href="struct.Files.html#method.method_guard" title="method actix_files::Files::method_guard"><code>Files::method_guard()</code></a>.</p>
|
|||
|
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_web::{guard::Header, App};
|
|||
|
<span class="kw">use </span>actix_files::Files;
|
|||
|
|
|||
|
App::new().service(
|
|||
|
Files::new(<span class="string">"/"</span>,<span class="string">"/my/site/files"</span>)
|
|||
|
.guard(Header(<span class="string">"Host"</span>, <span class="string">"example.com"</span>))
|
|||
|
);</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.method_guard" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#260-263">source</a><h4 class="code-header">pub fn <a href="#method.method_guard" class="fn">method_guard</a><G: Guard + 'static>(self, guard: G) -> Self</h4></section></summary><div class="docblock"><p>Specifies guard to check before fetching directory listings or files.</p>
|
|||
|
<p>Note that this guard has no effect on routing; it’s main use is to guard on the request’s
|
|||
|
method just before serving the file, only allowing <code>GET</code> and <code>HEAD</code> requests by default.
|
|||
|
See <a href="struct.Files.html#method.guard" title="method actix_files::Files::guard"><code>Files::guard</code></a> for routing guards.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.disable_content_disposition" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#275-278">source</a><h4 class="code-header">pub fn <a href="#method.disable_content_disposition" class="fn">disable_content_disposition</a>(self) -> Self</h4></section></summary><div class="docblock"><p>Disable <code>Content-Disposition</code> header.</p>
|
|||
|
<p>By default Content-Disposition` header is enabled.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_handler" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#300-312">source</a><h4 class="code-header">pub fn <a href="#method.default_handler" class="fn">default_handler</a><F, U>(self, f: F) -> Self<div class="where">where
|
|||
|
F: IntoServiceFactory<U, ServiceRequest>,
|
|||
|
U: ServiceFactory<ServiceRequest, Config = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Response = ServiceResponse, Error = Error> + 'static,</div></h4></section></summary><div class="docblock"><p>Sets default handler which is used when no matched file could be found.</p>
|
|||
|
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
|
|||
|
<p>Setting a fallback static file handler:</p>
|
|||
|
|
|||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_files::{Files, NamedFile};
|
|||
|
<span class="kw">use </span>actix_web::dev::{ServiceRequest, ServiceResponse, fn_service};
|
|||
|
|
|||
|
<span class="kw">let </span>files = Files::new(<span class="string">"/"</span>, <span class="string">"./static"</span>)
|
|||
|
.index_file(<span class="string">"index.html"</span>)
|
|||
|
.default_handler(fn_service(|req: ServiceRequest| <span class="kw">async </span>{
|
|||
|
<span class="kw">let </span>(req, <span class="kw">_</span>) = req.into_parts();
|
|||
|
<span class="kw">let </span>file = NamedFile::open_async(<span class="string">"./static/404.html"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
|||
|
<span class="kw">let </span>res = file.into_response(<span class="kw-2">&</span>req);
|
|||
|
<span class="prelude-val">Ok</span>(ServiceResponse::new(req, res))
|
|||
|
}));</code></pre></div>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.use_hidden_files" class="method"><a class="src rightside" href="../src/actix_files/files.rs.html#315-318">source</a><h4 class="code-header">pub fn <a href="#method.use_hidden_files" class="fn">use_hidden_files</a>(self) -> Self</h4></section></summary><div class="docblock"><p>Enables serving hidden files and directories, allowing a leading dots in url fragments.</p>
|
|||
|
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-Files" class="impl"><a class="src rightside" href="../src/actix_files/files.rs.html#60-78">source</a><a href="#impl-Clone-for-Files" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.Files.html" title="struct actix_files::Files">Files</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../src/actix_files/files.rs.html#61-77">source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&self) -> Self</h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#169">source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&Self</a>)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Files" class="impl"><a class="src rightside" href="../src/actix_files/files.rs.html#54-58">source</a><a href="#impl-Debug-for-Files" 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.Files.html" title="struct actix_files::Files">Files</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_files/files.rs.html#55-57">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-HttpServiceFactory-for-Files" class="impl"><a class="src rightside" href="../src/actix_files/files.rs.html#321-347">source</a><a href="#impl-HttpServiceFactory-for-Files" class="anchor">§</a><h3 class="code-header">impl HttpServiceFactory for <a class="struct" href="struct.Files.html" title="struct actix_files::Files">Files</a></h3></section></summary><div class="impl-items"><section id="method.register" class="m
|
|||
|
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-IntoServiceFactory%3CSF,+Req%3E-for-SF" class="impl"><a href="#impl-IntoServiceFactory%3CSF,+Req%3E-for-SF" class="anchor">§</a><h3 class="code-header">impl<SF, Req> IntoServiceFactory<SF, Req> for SF<div class="where">where
|
|||
|
SF: ServiceFactory<Req>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_factory" class="method trait-impl"><a href="#method.into_factory" class="anchor">§</a><h4 class="code-header">fn <a class="fn">into_factory</a>(self) -> SF</h4></section></summary><div class='docblock'>Convert <code>Self</code> to a <code>ServiceFactory</code></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-ServiceFactoryExt%3CReq%3E-for-SF" class="impl"><a href="#impl-ServiceFactoryExt%3CReq%3E-for-SF" class="anchor">§</a><h3 class="code-header">impl<SF, Req> ServiceFactoryExt<Req> for SF<div class="where">where
|
|||
|
SF: ServiceFactory<Req>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.map" class="method trait-impl"><a href="#method.map" class="anchor">§</a><h4 class="code-header">fn <a class="fn">map</a><F, R>(self, f: F) -> MapServiceFactory<Self, F, Req, R><div class="where">where
|
|||
|
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::Response) -> R + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class='docblock'>Map this service’s output to a different type, returning a new service
|
|||
|
of the resulting type.</div></details><details class="toggle method-toggle" open><summary><section id="method.map_err" class="method trait-impl"><a href="#method.map_err" class="anchor">§</a><h4 class="code-header">fn <a class="fn">map_err</a><F, E>(self, f: F) -> MapErrServiceFactory<Self, Req, F, E><div class="where">where
|
|||
|
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
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>(Self::Error) -> E + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class='docblock'>Map this service’s error to a different error, returning a new service.</div></details><details class="toggle method-toggle" open><summary><section id="method.map_init_err" class="method trait-impl"><a href="#method.map_init_err" class="anchor">§</a><h4 class="code-header">fn <a class="fn">map_init_err</a><F, E>(self, f: F) -> MapInitErr<Self, F, Req, E><div class="where">where
|
|||
|
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
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>(Self::InitError) -> E + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class='docblock'>Map this factory’s init error to a different error, returning a new service.</div></details><details class="toggle method-toggle" open><summary><section id="method.and_then" class="method trait-impl"><a href="#method.and_then" class="anchor">§</a><h4 class="code-header">fn <a class="fn">and_then</a><I, SF1>(self, factory: I) -> AndThenServiceFactory<Self, SF1, Req><div class="where">where
|
|||
|
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|||
|
Self::Config: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
|
|||
|
I: IntoServiceFactory<SF1, Self::Response>,
|
|||
|
SF1: ServiceFactory<Self::Response, Config = Self::Config, Error = Self::Error, InitError = Self::InitError>,</div></h4></section></summary><div class='docblock'>Call another service after call to this one has resolved successfully.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#83-85">source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
|
|||
|
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#88">source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&self) -> T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#92">source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-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-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#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-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#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></section></div></main></body></html>
|