194 lines
53 KiB
HTML
194 lines
53 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_files`."><meta name="keywords" content="rust, rustlang, rust-lang, NamedFile"><title>actix_files::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><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></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><a href='../actix_files/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><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.disable_content_disposition">disable_content_disposition</a><a href="#method.file">file</a><a href="#method.from_file">from_file</a><a href="#method.open">open</a><a href="#method.path">path</a><a href="#method.set_content_disposition">set_content_disposition</a><a href="#method.set_content_encoding">set_content_encoding</a><a href="#method.set_content_type">set_content_type</a><a href="#method.set_status_code">set_status_code</a><a href="#method.use_etag">use_etag</a><a href="#method.use_last_modified">use_last_modified</a></div><a class="sidebar-title" href="#deref-methods">Methods from Deref<Target=File></a><div class="sidebar-links"><a href="#method.metadata">metadata</a><a href="#method.set_len">set_len</a><a href="#method.set_permissions">set_permissions</a><a href="#method.sync_all">sync_all</a><a href="#method.sync_data">sync_data</a><a href="#method.try_clone">try_clone</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-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a></div></div><p class='location'><a href='index.html'>actix_files</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"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><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='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_files/named.rs.html#41-51' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='index.html'>actix_files</a>::<wbr><a class="struct" href=''>NamedFile</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct NamedFile { /* 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'><code class='in-band'>impl <a class="struct" href="../actix_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a></code><a href='#impl' class='anchor'></a><a class='srclink' href='../src/actix_files/named.rs.html#53-258' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from_file' class="method"><code id='from_file.v'>pub fn <a href='#method.from_file' class='fnname'>from_file</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>>>(file: <a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html" title="struct std::fs::File">File</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_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a>></code><a class='srclink' href='../src/actix_files/named.rs.html#75-126' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates an instance from a previously opened file.</p>
|
||
<p>The given <code>path</code> need not exist and is only used to determine the <code>ContentType</code> and
|
||
<code>ContentDisposition</code> headers.</p>
|
||
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">actix_files</span>::<span class="ident">NamedFile</span>;
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::{<span class="self">self</span>, <span class="ident">Write</span>};
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">env</span>;
|
||
<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="op">></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">create</span>(<span class="string">"foo.txt"</span>)<span class="question-mark">?</span>;
|
||
<span class="ident">file</span>.<span class="ident">write_all</span>(<span class="string">b"Hello, world!"</span>)<span class="question-mark">?</span>;
|
||
<span class="kw">let</span> <span class="ident">named_file</span> <span class="op">=</span> <span class="ident">NamedFile</span>::<span class="ident">from_file</span>(<span class="ident">file</span>, <span class="string">"bar.txt"</span>)<span class="question-mark">?</span>;
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</pre></div>
|
||
</div><h4 id='method.open' class="method"><code id='open.v'>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_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a>></code><a class='srclink' href='../src/actix_files/named.rs.html#137-139' title='goto source code'>[src]</a></h4><div class='docblock'><p>Attempts to open a file in read-only mode.</p>
|
||
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">actix_files</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><h4 id='method.file' class="method"><code id='file.v'>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><a class='srclink' href='../src/actix_files/named.rs.html#143-145' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns reference to the underlying <code>File</code> object.</p>
|
||
</div><h4 id='method.path' class="method"><code id='path.v'>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><a class='srclink' href='../src/actix_files/named.rs.html#162-164' title='goto source code'>[src]</a></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>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">actix_files</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>
|
||
</div><h4 id='method.set_status_code' class="method"><code id='set_status_code.v'>pub fn <a href='#method.set_status_code' class='fnname'>set_status_code</a>(self, status: <a class="struct" href="../http/status/struct.StatusCode.html" title="struct http::status::StatusCode">StatusCode</a>) -> Self</code><a class='srclink' href='../src/actix_files/named.rs.html#167-170' title='goto source code'>[src]</a></h4><div class='docblock'><p>Set response <strong>Status Code</strong></p>
|
||
</div><h4 id='method.set_content_type' class="method"><code id='set_content_type.v'>pub fn <a href='#method.set_content_type' class='fnname'>set_content_type</a>(self, mime_type: <a class="struct" href="../mime/struct.Mime.html" title="struct mime::Mime">Mime</a>) -> Self</code><a class='srclink' href='../src/actix_files/named.rs.html#175-178' title='goto source code'>[src]</a></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"><code id='set_content_disposition.v'>pub fn <a href='#method.set_content_disposition' class='fnname'>set_content_disposition</a>(self, cd: <a class="struct" href="../actix_http/header/common/content_disposition/struct.ContentDisposition.html" title="struct actix_http::header::common::content_disposition::ContentDisposition">ContentDisposition</a>) -> Self</code><a class='srclink' href='../src/actix_files/named.rs.html#188-192' title='goto source code'>[src]</a></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.disable_content_disposition' class="method"><code id='disable_content_disposition.v'>pub fn <a href='#method.disable_content_disposition' class='fnname'>disable_content_disposition</a>(self) -> Self</code><a class='srclink' href='../src/actix_files/named.rs.html#198-201' title='goto source code'>[src]</a></h4><div class='docblock'><p>Disable <code>Content-Disposition</code> header.</p>
|
||
<p>By default Content-Disposition` header is enabled.</p>
|
||
</div><h4 id='method.set_content_encoding' class="method"><code id='set_content_encoding.v'>pub fn <a href='#method.set_content_encoding' class='fnname'>set_content_encoding</a>(self, enc: <a class="enum" href="../actix_http/header/enum.ContentEncoding.html" title="enum actix_http::header::ContentEncoding">ContentEncoding</a>) -> Self</code><a class='srclink' href='../src/actix_files/named.rs.html#205-208' title='goto source code'>[src]</a></h4><div class='docblock'><p>Set content encoding for serving this file</p>
|
||
</div><h4 id='method.use_etag' class="method"><code id='use_etag.v'>pub fn <a href='#method.use_etag' class='fnname'>use_etag</a>(self, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> Self</code><a class='srclink' href='../src/actix_files/named.rs.html#214-217' title='goto source code'>[src]</a></h4><div class='docblock'><p>Specifies whether to use ETag or not.</p>
|
||
<p>Default is true.</p>
|
||
</div><h4 id='method.use_last_modified' class="method"><code id='use_last_modified.v'>pub fn <a href='#method.use_last_modified' class='fnname'>use_last_modified</a>(self, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> Self</code><a class='srclink' href='../src/actix_files/named.rs.html#223-226' title='goto source code'>[src]</a></h4><div class='docblock'><p>Specifies whether to use Last-Modified or not.</p>
|
||
<p>Default is true.</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"><code id='sync_all.v'>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 class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#457-459' title='goto source code'>[src]</a></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-memory data reaches the
|
||
filesystem before returning.</p>
|
||
<p>This can be used to handle errors that would otherwise only be caught
|
||
when the <code>File</code> is closed. Dropping a file will ignore errors in
|
||
synchronizing this in-memory data.</p>
|
||
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
|
||
<div class="example-wrap"><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="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>
|
||
</div><h4 id='method.sync_data' class="method"><code id='sync_data.v'>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 class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#488-490' title='goto source code'>[src]</a></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>
|
||
<div class="example-wrap"><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="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>
|
||
</div><h4 id='method.set_len' class="method"><code id='set_len.v'>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 class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#525-527' title='goto source code'>[src]</a></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.
|
||
Also, std::io::ErrorKind::InvalidInput will be returned if the desired
|
||
length would cause an overflow due to the implementation specifics.</p>
|
||
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
|
||
<div class="example-wrap"><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="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></div>
|
||
<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"><code id='metadata.v'>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 class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#543-545' title='goto source code'>[src]</a></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>
|
||
<div class="example-wrap"><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="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>
|
||
</div><h4 id='method.try_clone' class="method"><code id='try_clone.v'>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 class='since' title='Stable since Rust version 1.9.0'>1.9.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#587-589' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates 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>Creates two handles for a file named <code>foo.txt</code>:</p>
|
||
|
||
<div class="example-wrap"><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="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></div>
|
||
<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>
|
||
|
||
<div class="example-wrap"><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="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>
|
||
</div><h4 id='method.set_permissions' class="method"><code id='set_permissions.v'>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 class='since' title='Stable since Rust version 1.16.0'>1.16.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/std/fs.rs.html#624-626' title='goto source code'>[src]</a></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>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">fn</span> <span class="ident">main</span>() <span class="op">-</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></div>
|
||
<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'><code class='in-band'>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="../actix_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a></code><a href='#impl-Debug' class='anchor'></a><a class='srclink' href='../src/actix_files/named.rs.html#40' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method hidden"><code id='fmt.v'>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><a class='srclink' href='../src/actix_files/named.rs.html#40' title='goto source code'>[src]</a></h4><div class='docblock hidden'><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'><code class='in-band'>impl <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_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a></code><a href='#impl-Deref' class='anchor'></a><a class='srclink' href='../src/actix_files/named.rs.html#260-266' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Target' class="type"><code id='Target.t'>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></h4><div class='docblock'><p>The resulting type after dereferencing.</p>
|
||
</div><h4 id='method.deref' class="method hidden"><code id='deref.v'>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><a class='srclink' href='../src/actix_files/named.rs.html#263-265' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Dereferences the value.</p>
|
||
</div></div><h3 id='impl-DerefMut' class='impl'><code class='in-band'>impl <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_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a></code><a href='#impl-DerefMut' class='anchor'></a><a class='srclink' href='../src/actix_files/named.rs.html#268-272' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.deref_mut' class="method hidden"><code id='deref_mut.v'>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><a class='srclink' href='../src/actix_files/named.rs.html#269-271' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably dereferences the value.</p>
|
||
</div></div><h3 id='impl-Responder' class='impl'><code class='in-band'>impl <a class="trait" href="../actix_web/responder/trait.Responder.html" title="trait actix_web::responder::Responder">Responder</a> for <a class="struct" href="../actix_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a></code><a href='#impl-Responder' class='anchor'></a><a class='srclink' href='../src/actix_files/named.rs.html#309-449' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='../actix_web/responder/trait.Responder.html#associatedtype.Error' class="type">Error</a> = <a class="struct" href="../actix_http/error/struct.Error.html" title="struct actix_http::error::Error">Error</a></code></h4><div class='docblock'><p>The associated error which can be returned.</p>
|
||
</div><h4 id='associatedtype.Future' class="type"><code id='Future.t'>type <a href='../actix_web/responder/trait.Responder.html#associatedtype.Future' class="type">Future</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="struct" href="../actix_http/response/struct.Response.html" title="struct actix_http::response::Response">HttpResponse</a>, <a class="struct" href="../actix_http/error/struct.Error.html" title="struct actix_http::error::Error">Error</a>></code></h4><div class='docblock'><p>The future response value.</p>
|
||
</div><h4 id='method.respond_to' class="method hidden"><code id='respond_to.v'>fn <a href='../actix_web/responder/trait.Responder.html#tymethod.respond_to' class='fnname'>respond_to</a>(self, req: &<a class="struct" href="../actix_web/request/struct.HttpRequest.html" title="struct actix_web::request::HttpRequest">HttpRequest</a>) -> Self::<a class="type" href="../actix_web/responder/trait.Responder.html#associatedtype.Future" title="type actix_web::responder::Responder::Future">Future</a></code><a class='srclink' href='../src/actix_files/named.rs.html#313-448' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Convert itself to <code>AsyncResult</code> or <code>Error</code>.</p>
|
||
</div><h4 id='method.with_status' class="method hidden"><code id='with_status.v'>fn <a href='../actix_web/responder/trait.Responder.html#method.with_status' class='fnname'>with_status</a>(self, status: <a class="struct" href="../http/status/struct.StatusCode.html" title="struct http::status::StatusCode">StatusCode</a>) -> CustomResponder<Self></code><a class='srclink' href='../src/actix_web/responder.rs.html#36-41' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Override a status code for a Responder. <a href="../actix_web/responder/trait.Responder.html#method.with_status">Read more</a></p>
|
||
</div><h4 id='method.with_header' class="method hidden"><code id='with_header.v'>fn <a href='../actix_web/responder/trait.Responder.html#method.with_header' class='fnname'>with_header</a><K, V>(self, key: K, value: V) -> CustomResponder<Self> <span class="where fmt-newline">where<br> V: <a class="trait" href="../actix_http/header/trait.IntoHeaderValue.html" title="trait actix_http::header::IntoHeaderValue">IntoHeaderValue</a>,<br> <a class="struct" href="../http/header/name/struct.HeaderName.html" title="struct http::header::name::HeaderName">HeaderName</a>: <a class="trait" href="../http/convert/trait.HttpTryFrom.html" title="trait http::convert::HttpTryFrom">HttpTryFrom</a><K>, </span></code><a class='srclink' href='../src/actix_web/responder.rs.html#62-69' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Add header to the Responder's response. <a href="../actix_web/responder/trait.Responder.html#method.with_header">Read more</a></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-RefUnwindSafe' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../actix_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a></code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../actix_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../actix_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../actix_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a></code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../actix_files/struct.NamedFile.html" title="struct actix_files::NamedFile">NamedFile</a></code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-Any' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#108-112' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>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></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#109-111' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>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></p>
|
||
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-217' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-216' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220-224' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221-223' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>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></p>
|
||
</div></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>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</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#564-568' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -> T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#565-567' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#553-560' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -> U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#557-559' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#601-610' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>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="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#607-609' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#587-596' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-2' class="type"><code id='Error.t-2'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">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="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>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="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#593-595' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id='impl-VZip%3CV%3E' class='impl'><code class='in-band'>impl<V, T> <a class="trait" href="../ppv_lite86/types/types/trait.VZip.html" title="trait ppv_lite86::types::types::VZip">VZip</a><V> for T <span class="where fmt-newline">where<br> V: <a class="trait" href="../ppv_lite86/types/types/trait.MultiLane.html" title="trait ppv_lite86::types::types::MultiLane">MultiLane</a><T>, </span></code><a href='#impl-VZip%3CV%3E' class='anchor'></a><a class='srclink' href='../src/ppv_lite86/types.rs.html#212-220' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.vzip' class="method hidden"><code id='vzip.v'>fn <a href='../ppv_lite86/types/types/trait.VZip.html#tymethod.vzip' class='fnname'>vzip</a>(self) -> V</code><a class='srclink' href='../src/ppv_lite86/types.rs.html#217-219' title='goto source code'>[src]</a></h4></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "actix_files";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |