mirror of
https://github.com/actix/actix-website
synced 2024-11-24 16:52:59 +01:00
183 lines
47 KiB
HTML
183 lines
47 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="API documentation for the Rust `NamedFile` struct in crate `actix_web`."><meta name="keywords" content="rust, rustlang, rust-lang, NamedFile"><title>actix_web::fs::NamedFile - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><p class='location'>Struct NamedFile</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.open">open</a><a href="#method.open_with_config">open_with_config</a><a href="#method.file">file</a><a href="#method.path">path</a><a href="#method.set_cpu_pool">set_cpu_pool</a><a href="#method.set_status_code">set_status_code</a><a href="#method.set_content_type">set_content_type</a><a href="#method.set_content_disposition">set_content_disposition</a><a href="#method.set_content_encoding">set_content_encoding</a></div><a class="sidebar-title" href="#deref-methods">Methods from Deref<Target=File></a><div class="sidebar-links"><a href="#method.sync_all">sync_all</a><a href="#method.sync_data">sync_data</a><a href="#method.set_len">set_len</a><a href="#method.metadata">metadata</a><a href="#method.try_clone">try_clone</a><a href="#method.set_permissions">set_permissions</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Deref">Deref</a><a href="#impl-DerefMut">DerefMut</a><a href="#impl-Responder">Responder</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a></div></div><p class='location'><a href='../index.html'>actix_web</a>::<wbr><a href='index.html'>fs</a></p><script>window.sidebarCurrent = {name: 'NamedFile', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>actix_web</a>::<wbr><a href='index.html'>fs</a>::<wbr><a class="struct" href=''>NamedFile</a></span><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../../src/actix_web/fs.rs.html#109-120' title='goto source code'>[src]</a></span></h1><div class="docblock type-decl"><pre class='rust struct'>pub struct NamedFile<C = <a class="struct" href="../../actix_web/fs/struct.DefaultConfig.html" title="struct actix_web::fs::DefaultConfig">DefaultConfig</a>> { /* fields omitted */ }</pre></div><div class='docblock'><p>A file with an associated name.</p>
|
|||
|
</div>
|
|||
|
<h2 id='methods' class='small-section-header'>
|
|||
|
Methods<a href='#methods' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<h3 id='impl' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl <a class="struct" href="../../actix_web/fs/struct.NamedFile.html" title="struct actix_web::fs::NamedFile">NamedFile</a></code><a href='#impl' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#122-135' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.open' class="method"><span id='open.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.open' class='fnname'>open</a><P: <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>>>(path: P) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="../../actix_web/fs/struct.NamedFile.html" title="struct actix_web::fs::NamedFile">NamedFile</a>></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#132-134' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Attempts to open a file in read-only mode.</p>
|
|||
|
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">actix_web</span>::<span class="ident">fs</span>::<span class="ident">NamedFile</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">NamedFile</span>::<span class="ident">open</span>(<span class="string">"foo.txt"</span>);</pre>
|
|||
|
</div></div><h3 id='impl-1' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<C: <a class="trait" href="../../actix_web/fs/trait.StaticFileConfig.html" title="trait actix_web::fs::StaticFileConfig">StaticFileConfig</a>> <a class="struct" href="../../actix_web/fs/struct.NamedFile.html" title="struct actix_web::fs::NamedFile">NamedFile</a><C></code><a href='#impl-1' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#137-291' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.open_with_config' class="method"><span id='open_with_config.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.open_with_config' class='fnname'>open_with_config</a><P: <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>>>(path: P, _: C) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="../../actix_web/fs/struct.NamedFile.html" title="struct actix_web::fs::NamedFile">NamedFile</a><C>></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#147-193' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Attempts to open a file in read-only mode using provided configiration.</p>
|
|||
|
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">actix_web</span>::<span class="ident">fs</span>::{<span class="ident">DefaultConfig</span>, <span class="ident">NamedFile</span>};
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">NamedFile</span>::<span class="ident">open_with_config</span>(<span class="string">"foo.txt"</span>, <span class="ident">DefaultConfig</span>);</pre>
|
|||
|
</div><h4 id='method.file' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span></code></div></div><span id='file.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.file' class='fnname'>file</a>(&self) -> &<a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#197-199' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Returns reference to the underlying <code>File</code> object.</p>
|
|||
|
</div><h4 id='method.path' class="method"><span id='path.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.path' class='fnname'>path</a>(&self) -> &<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#216-218' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Retrieve the path of this file.</p>
|
|||
|
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">actix_web</span>::<span class="ident">fs</span>::<span class="ident">NamedFile</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">NamedFile</span>::<span class="ident">open</span>(<span class="string">"test.txt"</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">file</span>.<span class="ident">path</span>().<span class="ident">as_os_str</span>(), <span class="string">"foo.txt"</span>);</pre>
|
|||
|
</div><h4 id='method.set_cpu_pool' class="method"><span id='set_cpu_pool.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.set_cpu_pool' class='fnname'>set_cpu_pool</a>(self, cpu_pool: CpuPool) -> Self</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#222-225' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Set <code>CpuPool</code> to use</p>
|
|||
|
</div><h4 id='method.set_status_code' class="method"><span id='set_status_code.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.set_status_code' class='fnname'>set_status_code</a>(self, status: <a class="struct" href="../../actix_web/http/struct.StatusCode.html" title="struct actix_web::http::StatusCode">StatusCode</a>) -> Self</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#228-231' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Set response <strong>Status Code</strong></p>
|
|||
|
</div><h4 id='method.set_content_type' class="method"><span id='set_content_type.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.set_content_type' class='fnname'>set_content_type</a>(self, mime_type: <a class="struct" href="https://docs.rs/mime/0.3.8/mime/struct.Mime.html" title="struct mime::Mime">Mime</a>) -> Self</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#236-239' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Set the MIME Content-Type for serving this file. By default
|
|||
|
the Content-Type is inferred from the filename extension.</p>
|
|||
|
</div><h4 id='method.set_content_disposition' class="method"><span id='set_content_disposition.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.set_content_disposition' class='fnname'>set_content_disposition</a>(self, cd: <a class="struct" href="../../actix_web/http/header/struct.ContentDisposition.html" title="struct actix_web::http::header::ContentDisposition">ContentDisposition</a>) -> Self</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#249-252' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Set the Content-Disposition for serving this file. This allows
|
|||
|
changing the inline/attachment disposition as well as the filename
|
|||
|
sent to the peer. By default the disposition is <code>inline</code> for text,
|
|||
|
image, and video content types, and <code>attachment</code> otherwise, and
|
|||
|
the filename is taken from the path provided in the <code>open</code> method
|
|||
|
after converting it to UTF-8 using
|
|||
|
<a href="https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.to_string_lossy">to_string_lossy</a>.</p>
|
|||
|
</div><h4 id='method.set_content_encoding' class="method"><span id='set_content_encoding.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.set_content_encoding' class='fnname'>set_content_encoding</a>(self, enc: <a class="enum" href="../../actix_web/http/enum.ContentEncoding.html" title="enum actix_web::http::ContentEncoding">ContentEncoding</a>) -> Self</code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#256-259' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Set content encoding for serving this file</p>
|
|||
|
</div></div>
|
|||
|
<h2 id='deref-methods' class='small-section-header'>
|
|||
|
Methods from <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a>><a href='#deref-methods' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<div class='impl-items'><h4 id='method.sync_all' class="method"><span id='sync_all.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.sync_all' class='fnname'>sync_all</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#412-414' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Attempts to sync all OS-internal metadata to disk.</p>
|
|||
|
<p>This function will attempt to ensure that all in-core data reaches the
|
|||
|
filesystem before returning.</p>
|
|||
|
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|||
|
|
|||
|
<span class="kw">fn</span> <span class="ident">main</span>() <span class="op">-></span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="prelude-ty">Result</span><span class="op"><</span>()<span class="op">></span> {
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">File</span>::<span class="ident">create</span>(<span class="string">"foo.txt"</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="ident">f</span>.<span class="ident">write_all</span>(<span class="string">b"Hello, world!"</span>)<span class="question-mark">?</span>;
|
|||
|
|
|||
|
<span class="ident">f</span>.<span class="ident">sync_all</span>()<span class="question-mark">?</span>;
|
|||
|
<span class="prelude-val">Ok</span>(())
|
|||
|
}</pre>
|
|||
|
</div><h4 id='method.sync_data' class="method"><span id='sync_data.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.sync_data' class='fnname'>sync_data</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#443-445' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>This function is similar to <a href="struct.File.html#method.sync_all"><code>sync_all</code></a>, except that it may not
|
|||
|
synchronize file metadata to the filesystem.</p>
|
|||
|
<p>This is intended for use cases that must synchronize content, but don't
|
|||
|
need the metadata on disk. The goal of this method is to reduce disk
|
|||
|
operations.</p>
|
|||
|
<p>Note that some platforms may simply implement this in terms of
|
|||
|
<a href="struct.File.html#method.sync_all"><code>sync_all</code></a>.</p>
|
|||
|
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|||
|
|
|||
|
<span class="kw">fn</span> <span class="ident">main</span>() <span class="op">-></span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="prelude-ty">Result</span><span class="op"><</span>()<span class="op">></span> {
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">File</span>::<span class="ident">create</span>(<span class="string">"foo.txt"</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="ident">f</span>.<span class="ident">write_all</span>(<span class="string">b"Hello, world!"</span>)<span class="question-mark">?</span>;
|
|||
|
|
|||
|
<span class="ident">f</span>.<span class="ident">sync_data</span>()<span class="question-mark">?</span>;
|
|||
|
<span class="prelude-val">Ok</span>(())
|
|||
|
}</pre>
|
|||
|
</div><h4 id='method.set_len' class="method"><span id='set_len.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.set_len' class='fnname'>set_len</a>(&self, size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</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>></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#478-480' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Truncates or extends the underlying file, updating the size of
|
|||
|
this file to become <code>size</code>.</p>
|
|||
|
<p>If the <code>size</code> is less than the current file's size, then the file will
|
|||
|
be shrunk. If it is greater than the current file's size, then the file
|
|||
|
will be extended to <code>size</code> and have all of the intermediate data filled
|
|||
|
in with 0s.</p>
|
|||
|
<p>The file's cursor isn't changed. In particular, if the cursor was at the
|
|||
|
end and the file is shrunk using this operation, the cursor will now be
|
|||
|
past the end.</p>
|
|||
|
<h1 id="errors" class="section-header"><a href="#errors">Errors</a></h1>
|
|||
|
<p>This function will return an error if the file is not opened for writing.</p>
|
|||
|
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
|
|||
|
|
|||
|
<span class="kw">fn</span> <span class="ident">main</span>() <span class="op">-></span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="prelude-ty">Result</span><span class="op"><</span>()<span class="op">></span> {
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">File</span>::<span class="ident">create</span>(<span class="string">"foo.txt"</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="ident">f</span>.<span class="ident">set_len</span>(<span class="number">10</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="prelude-val">Ok</span>(())
|
|||
|
}</pre>
|
|||
|
<p>Note that this method alters the content of the underlying file, even
|
|||
|
though it takes <code>&self</code> rather than <code>&mut self</code>.</p>
|
|||
|
</div><h4 id='method.metadata' class="method"><span id='metadata.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.metadata' class='fnname'>metadata</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.Metadata.html" title="struct std::fs::Metadata">Metadata</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>></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#496-498' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Queries metadata about the underlying file.</p>
|
|||
|
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
|
|||
|
|
|||
|
<span class="kw">fn</span> <span class="ident">main</span>() <span class="op">-></span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="prelude-ty">Result</span><span class="op"><</span>()<span class="op">></span> {
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">File</span>::<span class="ident">open</span>(<span class="string">"foo.txt"</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="kw">let</span> <span class="ident">metadata</span> <span class="op">=</span> <span class="ident">f</span>.<span class="ident">metadata</span>()<span class="question-mark">?</span>;
|
|||
|
<span class="prelude-val">Ok</span>(())
|
|||
|
}</pre>
|
|||
|
</div><h4 id='method.try_clone' class="method"><span id='try_clone.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.try_clone' class='fnname'>try_clone</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</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>></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.9.0'>1.9.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#540-544' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Create a new <code>File</code> instance that shares the same underlying file handle
|
|||
|
as the existing <code>File</code> instance. Reads, writes, and seeks will affect
|
|||
|
both <code>File</code> instances simultaneously.</p>
|
|||
|
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
|
|||
|
<p>Create two handles for a file named <code>foo.txt</code>:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
|
|||
|
|
|||
|
<span class="kw">fn</span> <span class="ident">main</span>() <span class="op">-></span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="prelude-ty">Result</span><span class="op"><</span>()<span class="op">></span> {
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">File</span>::<span class="ident">open</span>(<span class="string">"foo.txt"</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="kw">let</span> <span class="ident">file_copy</span> <span class="op">=</span> <span class="ident">file</span>.<span class="ident">try_clone</span>()<span class="question-mark">?</span>;
|
|||
|
<span class="prelude-val">Ok</span>(())
|
|||
|
}</pre>
|
|||
|
<p>Assuming there’s a file named <code>foo.txt</code> with contents <code>abcdef\n</code>, create
|
|||
|
two handles, seek one of them, and read the remaining bytes from the
|
|||
|
other handle:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">SeekFrom</span>;
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">prelude</span>::<span class="kw-2">*</span>;
|
|||
|
|
|||
|
<span class="kw">fn</span> <span class="ident">main</span>() <span class="op">-></span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="prelude-ty">Result</span><span class="op"><</span>()<span class="op">></span> {
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">File</span>::<span class="ident">open</span>(<span class="string">"foo.txt"</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">file_copy</span> <span class="op">=</span> <span class="ident">file</span>.<span class="ident">try_clone</span>()<span class="question-mark">?</span>;
|
|||
|
|
|||
|
<span class="ident">file</span>.<span class="ident">seek</span>(<span class="ident">SeekFrom</span>::<span class="ident">Start</span>(<span class="number">3</span>))<span class="question-mark">?</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">contents</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[];
|
|||
|
<span class="ident">file_copy</span>.<span class="ident">read_to_end</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">contents</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">contents</span>, <span class="string">b"def\n"</span>);
|
|||
|
<span class="prelude-val">Ok</span>(())
|
|||
|
}</pre>
|
|||
|
</div><h4 id='method.set_permissions' class="method"><span id='set_permissions.v' class='invisible'><table class='table-display'><tbody><tr><td><code>pub fn <a href='#method.set_permissions' class='fnname'>set_permissions</a>(&self, perm: <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.Permissions.html" title="struct std::fs::Permissions">Permissions</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>></code></span></td><td><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.16.0'>1.16.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#579-581' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Changes the permissions on the underlying file.</p>
|
|||
|
<h1 id="platform-specific-behavior" class="section-header"><a href="#platform-specific-behavior">Platform-specific behavior</a></h1>
|
|||
|
<p>This function currently corresponds to the <code>fchmod</code> function on Unix and
|
|||
|
the <code>SetFileInformationByHandle</code> function on Windows. Note that, this
|
|||
|
<a href="../io/index.html#platform-specific-behavior">may change in the future</a>.</p>
|
|||
|
<h1 id="errors-1" class="section-header"><a href="#errors-1">Errors</a></h1>
|
|||
|
<p>This function will return an error if the user lacks permission change
|
|||
|
attributes on the underlying file. It may also return an error in other
|
|||
|
os-specific unspecified cases.</p>
|
|||
|
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">fn</span> <span class="ident">main</span>() <span class="op">-></span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="prelude-ty">Result</span><span class="op"><</span>()<span class="op">></span> {
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">File</span>::<span class="ident">open</span>(<span class="string">"foo.txt"</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">perms</span> <span class="op">=</span> <span class="ident">file</span>.<span class="ident">metadata</span>()<span class="question-mark">?</span>.<span class="ident">permissions</span>();
|
|||
|
<span class="ident">perms</span>.<span class="ident">set_readonly</span>(<span class="bool-val">true</span>);
|
|||
|
<span class="ident">file</span>.<span class="ident">set_permissions</span>(<span class="ident">perms</span>)<span class="question-mark">?</span>;
|
|||
|
<span class="prelude-val">Ok</span>(())
|
|||
|
}</pre>
|
|||
|
<p>Note that this method alters the permissions of the underlying file,
|
|||
|
even though it takes <code>&self</code> rather than <code>&mut self</code>.</p>
|
|||
|
</div></div>
|
|||
|
<h2 id='implementations' class='small-section-header'>
|
|||
|
Trait Implementations<a href='#implementations' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<div id='implementations-list'><h3 id='impl-Debug' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<C: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>> <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="../../actix_web/fs/struct.NamedFile.html" title="struct actix_web::fs::NamedFile">NamedFile</a><C></code><a href='#impl-Debug' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#108' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>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></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#108' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>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></p>
|
|||
|
</div></div><h3 id='impl-Deref' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<C> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="../../actix_web/fs/struct.NamedFile.html" title="struct actix_web::fs::NamedFile">NamedFile</a><C></code><a href='#impl-Deref' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#293-299' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='associatedtype.Target' class="type"><span id='Target.t' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target' class="type">Target</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></code></span></h4>
|
|||
|
<div class='docblock'><p>The resulting type after dereferencing.</p>
|
|||
|
</div><h4 id='method.deref' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span></code></div></div><span id='deref.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#tymethod.deref' class='fnname'>deref</a>(&self) -> &<a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#296-298' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Dereferences the value.</p>
|
|||
|
</div></div><h3 id='impl-DerefMut' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<C> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a> for <a class="struct" href="../../actix_web/fs/struct.NamedFile.html" title="struct actix_web::fs::NamedFile">NamedFile</a><C></code><a href='#impl-DerefMut' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#301-305' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='method.deref_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></span></code></div></div><span id='deref_mut.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html#tymethod.deref_mut' class='fnname'>deref_mut</a>(&mut self) -> &mut <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#302-304' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Mutably dereferences the value.</p>
|
|||
|
</div></div><h3 id='impl-Responder' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<C: <a class="trait" href="../../actix_web/fs/trait.StaticFileConfig.html" title="trait actix_web::fs::StaticFileConfig">StaticFileConfig</a>> <a class="trait" href="../../actix_web/trait.Responder.html" title="trait actix_web::Responder">Responder</a> for <a class="struct" href="../../actix_web/fs/struct.NamedFile.html" title="struct actix_web::fs::NamedFile">NamedFile</a><C></code><a href='#impl-Responder' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#342-480' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='impl-items'><h4 id='associatedtype.Item' class="type"><span id='Item.t' class='invisible'><code>type <a href='../../actix_web/trait.Responder.html#associatedtype.Item' class="type">Item</a> = <a class="struct" href="../../actix_web/struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</a></code></span></h4>
|
|||
|
<div class='docblock'><p>The associated item which can be returned.</p>
|
|||
|
</div><h4 id='associatedtype.Error' class="type"><span id='Error.t' class='invisible'><code>type <a href='../../actix_web/trait.Responder.html#associatedtype.Error' class="type">Error</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></code></span></h4>
|
|||
|
<div class='docblock'><p>The associated error which can be returned.</p>
|
|||
|
</div><h4 id='method.respond_to' class="method"><span id='respond_to.v' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../../actix_web/trait.Responder.html#tymethod.respond_to' class='fnname'>respond_to</a><S>(self, req: &<a class="struct" href="../../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../../actix_web/struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</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>></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/actix_web/fs.rs.html#346-479' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><div class='docblock'><p>Convert itself to <code>AsyncResult</code> or <code>Error</code>.</p>
|
|||
|
</div></div></div>
|
|||
|
<h2 id='synthetic-implementations' class='small-section-header'>
|
|||
|
Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<div id='synthetic-implementations-list'>
|
|||
|
<h3 id='impl-Send' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<C> <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="../../actix_web/fs/struct.NamedFile.html" title="struct actix_web::fs::NamedFile">NamedFile</a><C> <span class="where fmt-newline">where<br> C: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>, </span></code><a href='#impl-Send' class='anchor'></a></span></td><td><span class='out-of-band'></span></td></tr></tbody></table></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<C> <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="../../actix_web/fs/struct.NamedFile.html" title="struct actix_web::fs::NamedFile">NamedFile</a><C> <span class="where fmt-newline">where<br> C: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>, </span></code><a href='#impl-Sync' class='anchor'></a></span></td><td><span class='out-of-band'></span></td></tr></tbody></table></h3><div class='impl-items'></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "actix_web";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|