<!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 `File` struct in crate `std`."> <meta name="keywords" content="rust, rustlang, rust-lang, File"> <title>std::fs::File - 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="../../main.css" id="themeStyle"> <script src="../../storage.js"></script> <link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"> </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='../../std/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo' width='100'></a> <p class='location'>Struct File</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.create">create</a><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-Read">Read</a><a href="#impl-Write">Write</a><a href="#impl-Seek">Seek</a><a href="#impl-From%3CFile%3E">From<File></a><a href="#impl-AsRawFd">AsRawFd</a><a href="#impl-FromRawFd">FromRawFd</a><a href="#impl-IntoRawFd">IntoRawFd</a><a href="#impl-FileExt">FileExt</a><a href="#impl-AsRawHandle">AsRawHandle</a><a href="#impl-FromRawHandle">FromRawHandle</a><a href="#impl-IntoRawHandle">IntoRawHandle</a></div></div><p class='location'><a href='../index.html'>std</a>::<wbr><a href='index.html'>fs</a></p><script>window.sidebarCurrent = {name: 'File', 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"> </div> </form> </nav> <section id='main' class="content"> <h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>std</a>::<wbr><a href='index.html'>fs</a>::<wbr><a class="struct" href=''>File</a></span><span class='out-of-band'><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><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/std/fs.rs.html#89-91' title='goto source code'>[src]</a></span></h1> <pre class='rust struct'>pub struct File { /* fields omitted */ }</pre><div class='docblock'><p>A reference to an open file on the filesystem.</p> <p>An instance of a <code>File</code> can be read and/or written depending on what options it was opened with. Files also implement <a href="../io/trait.Seek.html"><code>Seek</code></a> to alter the logical cursor that the file contains internally.</p> <p>Files are automatically closed when they go out of scope.</p> <h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1> <p>Create a new file and write bytes to it:</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">prelude</span>::<span class="kw-2">*</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>;<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0Ause%20std%3A%3Aio%3A%3Aprelude%3A%3A*%3B%0A%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Alet%20mut%20file%20%3D%20File%3A%3Acreate(%22foo.txt%22)%3F%3B%0Afile.write_all(b%22Hello%2C%20world!%22)%3F%3B%0AOk(())%0A%7D%0A%7D">Run</a></pre> <p>Read the contents of a file into a <a href="../string/struct.String.html"><code>String</code></a>:</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">prelude</span>::<span class="kw-2">*</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">contents</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">new</span>(); <span class="ident">file</span>.<span class="ident">read_to_string</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">"Hello, world!"</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0Ause%20std%3A%3Aio%3A%3Aprelude%3A%3A*%3B%0A%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Alet%20mut%20file%20%3D%20File%3A%3Aopen(%22foo.txt%22)%3F%3B%0Alet%20mut%20contents%20%3D%20String%3A%3Anew()%3B%0Afile.read_to_string(%26mut%20contents)%3F%3B%0Aassert_eq!(contents%2C%20%22Hello%2C%20world!%22)%3B%0AOk(())%0A%7D%0A%7D">Run</a></pre> <p>It can be more efficient to read the contents of a file with a buffered <a href="../io/trait.Read.html"><code>Read</code></a>er. This can be accomplished with <a href="../io/struct.BufReader.html"><code>BufReader<R></code></a>:</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">BufReader</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">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">buf_reader</span> <span class="op">=</span> <span class="ident">BufReader</span>::<span class="ident">new</span>(<span class="ident">file</span>); <span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">contents</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">new</span>(); <span class="ident">buf_reader</span>.<span class="ident">read_to_string</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">"Hello, world!"</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0Ause%20std%3A%3Aio%3A%3ABufReader%3B%0Ause%20std%3A%3Aio%3A%3Aprelude%3A%3A*%3B%0A%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Alet%20file%20%3D%20File%3A%3Aopen(%22foo.txt%22)%3F%3B%0Alet%20mut%20buf_reader%20%3D%20BufReader%3A%3Anew(file)%3B%0Alet%20mut%20contents%20%3D%20String%3A%3Anew()%3B%0Abuf_reader.read_to_string(%26mut%20contents)%3F%3B%0Aassert_eq!(contents%2C%20%22Hello%2C%20world!%22)%3B%0AOk(())%0A%7D%0A%7D">Run</a></pre> </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'><code>impl <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#333-564' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.open' class="method"><span id='open.v' class='invisible'><code>pub fn <a href='#method.open' class='fnname'>open</a><P: <a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a><<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>>>(path: P) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#356-358' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Attempts to open a file in read-only mode.</p> <p>See the <a href="struct.OpenOptions.html#method.open"><code>OpenOptions::open</code></a> method for more details.</p> <h1 id="errors" class="section-header"><a href="#errors">Errors</a></h1> <p>This function will return an error if <code>path</code> does not already exist. Other errors may also be returned according to <a href="struct.OpenOptions.html#method.open"><code>OpenOptions::open</code></a>.</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">std</span>::<span class="ident">fs</span>::<span class="ident">File</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>;<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0A%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Alet%20mut%20f%20%3D%20File%3A%3Aopen(%22foo.txt%22)%3F%3B%0AOk(())%0A%7D%0A%7D">Run</a></pre> </div><h4 id='method.create' class="method"><span id='create.v' class='invisible'><code>pub fn <a href='#method.create' class='fnname'>create</a><P: <a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a><<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>>>(path: P) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#380-382' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Opens a file in write-only mode.</p> <p>This function will create a file if it does not exist, and will truncate it if it does.</p> <p>See the <a href="struct.OpenOptions.html#method.open"><code>OpenOptions::open</code></a> function for more details.</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">std</span>::<span class="ident">fs</span>::<span class="ident">File</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>;<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0A%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Alet%20mut%20f%20%3D%20File%3A%3Acreate(%22foo.txt%22)%3F%3B%0AOk(())%0A%7D%0A%7D">Run</a></pre> </div><h4 id='method.sync_all' class="method"><span id='sync_all.v' class='invisible'><code>pub fn <a href='#method.sync_all' class='fnname'>sync_all</a>(&self) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#404-406' title='goto source code'>[src]</a></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">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>;<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0Ause%20std%3A%3Aio%3A%3Aprelude%3A%3A*%3B%0A%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Alet%20mut%20f%20%3D%20File%3A%3Acreate(%22foo.txt%22)%3F%3B%0Af.write_all(b%22Hello%2C%20world!%22)%3F%3B%0A%0Af.sync_all()%3F%3B%0AOk(())%0A%7D%0A%7D">Run</a></pre> </div><h4 id='method.sync_data' class="method"><span id='sync_data.v' class='invisible'><code>pub fn <a href='#method.sync_data' class='fnname'>sync_data</a>(&self) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#435-437' title='goto source code'>[src]</a></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">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>;<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0Ause%20std%3A%3Aio%3A%3Aprelude%3A%3A*%3B%0A%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Alet%20mut%20f%20%3D%20File%3A%3Acreate(%22foo.txt%22)%3F%3B%0Af.write_all(b%22Hello%2C%20world!%22)%3F%3B%0A%0Af.sync_data()%3F%3B%0AOk(())%0A%7D%0A%7D">Run</a></pre> </div><h4 id='method.set_len' class="method"><span id='set_len.v' class='invisible'><code>pub fn <a href='#method.set_len' class='fnname'>set_len</a>(&self, size: <a class="primitive" href="../primitive.u64.html">u64</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#463-465' title='goto source code'>[src]</a></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> <h1 id="errors-1" class="section-header"><a href="#errors-1">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">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>;<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0A%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Alet%20mut%20f%20%3D%20File%3A%3Acreate(%22foo.txt%22)%3F%3B%0Af.set_len(10)%3F%3B%0AOk(())%0A%7D%0A%7D">Run</a></pre> </div><h4 id='method.metadata' class="method"><span id='metadata.v' class='invisible'><code>pub fn <a href='#method.metadata' class='fnname'>metadata</a>(&self) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="struct" href="../../std/fs/struct.Metadata.html" title="struct std::fs::Metadata">Metadata</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#481-483' title='goto source code'>[src]</a></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">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>;<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0A%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Alet%20mut%20f%20%3D%20File%3A%3Aopen(%22foo.txt%22)%3F%3B%0Alet%20metadata%20%3D%20f.metadata()%3F%3B%0AOk(())%0A%7D%0A%7D">Run</a></pre> </div><h4 id='method.try_clone' class="method"><span id='try_clone.v' class='invisible'><code>pub fn <a href='#method.try_clone' class='fnname'>try_clone</a>(&self) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a>></code></span><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='../../src/std/fs.rs.html#525-529' title='goto source code'>[src]</a></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">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>;<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0A%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Alet%20mut%20file%20%3D%20File%3A%3Aopen(%22foo.txt%22)%3F%3B%0Alet%20file_copy%20%3D%20file.try_clone()%3F%3B%0AOk(())%0A%7D%0A%7D">Run</a></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">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>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0Ause%20std%3A%3Aio%3A%3ASeekFrom%3B%0Ause%20std%3A%3Aio%3A%3Aprelude%3A%3A*%3B%0A%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Alet%20mut%20file%20%3D%20File%3A%3Aopen(%22foo.txt%22)%3F%3B%0Alet%20mut%20file_copy%20%3D%20file.try_clone()%3F%3B%0A%0Afile.seek(SeekFrom%3A%3AStart(3))%3F%3B%0A%0Alet%20mut%20contents%20%3D%20vec!%5B%5D%3B%0Afile_copy.read_to_end(%26mut%20contents)%3F%3B%0Aassert_eq!(contents%2C%20b%22def%5Cn%22)%3B%0AOk(())%0A%7D%0A%7D">Run</a></pre> </div><h4 id='method.set_permissions' class="method"><span id='set_permissions.v' class='invisible'><code>pub fn <a href='#method.set_permissions' class='fnname'>set_permissions</a>(&self, perm: <a class="struct" href="../../std/fs/struct.Permissions.html" title="struct std::fs::Permissions">Permissions</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><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='../../src/std/fs.rs.html#561-563' title='goto source code'>[src]</a></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-2" class="section-header"><a href="#errors-2">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">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>;<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Afn%20foo()%20-%3E%20std%3A%3Aio%3A%3AResult%3C()%3E%20%7B%0Ause%20std%3A%3Afs%3A%3AFile%3B%0A%0Alet%20file%20%3D%20File%3A%3Aopen(%22foo.txt%22)%3F%3B%0Alet%20mut%20perms%20%3D%20file.metadata()%3F.permissions()%3B%0Aperms.set_readonly(true)%3B%0Afile.set_permissions(perms)%3F%3B%0AOk(())%0A%7D%0A%7D">Run</a></pre> </div></div> <h2 id='implementations' class='small-section-header'> Trait Implementations<a href='#implementations' class='anchor'></a> </h2> <h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/fmt/trait.Debug.html" title="trait std::fmt::Debug">Debug</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#581-585' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='../../std/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class="struct" href="../../std/fmt/struct.Formatter.html" title="struct std::fmt::Formatter">Formatter</a>) -> <a class="type" href="../../std/fmt/type.Result.html" title="type std::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#582-584' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Formats the value using the given formatter. <a href="../../std/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p> </div></div><h3 id='impl-Read' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-Read' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#588-597' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.read' class="method"><span id='read.v' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#tymethod.read' class='fnname'>read</a>(&mut self, buf: <a class="primitive" href="../primitive.slice.html">&mut [</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#589-591' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Pull some bytes from this source into the specified buffer, returning how many bytes were read. <a href="../../std/io/trait.Read.html#tymethod.read">Read more</a></p> </div><h4 id='method.initializer' class="method"><span id='initializer.v' class='invisible'><code>unsafe fn <a href='../../std/io/trait.Read.html#method.initializer' class='fnname'>initializer</a>(&self) -> <a class="struct" href="../../std/io/struct.Initializer.html" title="struct std::io::Initializer">Initializer</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#594-596' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>read_initializer </code><a href="https://github.com/rust-lang/rust/issues/42788">#42788</a>)</div></div><div class='docblock'><p>Determines if this <code>Read</code>er can work with buffers of uninitialized memory. <a href="../../std/io/trait.Read.html#method.initializer">Read more</a></p> </div><h4 id='method.read_to_end' class="method"><span id='read_to_end.v' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.read_to_end' class='fnname'>read_to_end</a>(&mut self, buf: &mut <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a><<a class="primitive" href="../primitive.u8.html">u8</a>>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#600-602' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Read all bytes until EOF in this source, placing them into <code>buf</code>. <a href="../../std/io/trait.Read.html#method.read_to_end">Read more</a></p> </div><h4 id='method.read_to_string' class="method"><span id='read_to_string.v' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.read_to_string' class='fnname'>read_to_string</a>(&mut self, buf: &mut <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#638-649' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Read all bytes until EOF in this source, appending them to <code>buf</code>. <a href="../../std/io/trait.Read.html#method.read_to_string">Read more</a></p> </div><h4 id='method.read_exact' class="method"><span id='read_exact.v' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.read_exact' class='fnname'>read_exact</a>(&mut self, buf: <a class="primitive" href="../primitive.slice.html">&mut [</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.6.0'>1.6.0</div><a class='srclink' href='../../src/std/io/mod.rs.html#701-716' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Read the exact number of bytes required to fill <code>buf</code>. <a href="../../std/io/trait.Read.html#method.read_exact">Read more</a></p> </div><h4 id='method.by_ref' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I</h3><code class="content"><span class="where fmt-newline">impl<'a, I> <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I <span class="where fmt-newline">where<br> I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></span><span class="where fmt-newline"> type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>>::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl<'a, R: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>> <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>R</span><span class="where fmt-newline">impl<'a, W: <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>> <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>W</span></code></div></div><span id='by_ref.v' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.by_ref' class='fnname'>by_ref</a>(&mut self) -> <a class="primitive" href="../primitive.reference.html">&mut </a>Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#753' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Creates a "by reference" adaptor for this instance of <code>Read</code>. <a href="../../std/io/trait.Read.html#method.by_ref">Read more</a></p> </div><h4 id='method.bytes' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><R></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><R></h3><code class="content"><span class="where fmt-newline">impl<R: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>> <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><R></span><span class="where fmt-newline"> type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.u8.html">u8</a>>;</span></code></div></div><span id='bytes.v' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.bytes' class='fnname'>bytes</a>(self) -> <a class="struct" href="../../std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><Self> <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#790-792' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Transforms this <code>Read</code> instance to an [<code>Iterator</code>] over its bytes. <a href="../../std/io/trait.Read.html#method.bytes">Read more</a></p> </div><h4 id='method.chars' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/io/struct.Chars.html" title="struct std::io::Chars">Chars</a><R></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/io/struct.Chars.html" title="struct std::io::Chars">Chars</a><R></h3><code class="content"><span class="where fmt-newline">impl<R: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>> <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/io/struct.Chars.html" title="struct std::io::Chars">Chars</a><R></span><span class="where fmt-newline"> type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.char.html">char</a>, <a class="enum" href="../../std/io/enum.CharsError.html" title="enum std::io::CharsError">CharsError</a>>;</span></code></div></div><span id='chars.v' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.chars' class='fnname'>chars</a>(self) -> <a class="struct" href="../../std/io/struct.Chars.html" title="struct std::io::Chars">Chars</a><Self> <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#834-836' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>io </code><a href="https://github.com/rust-lang/rust/issues/27802">#27802</a>)</summary><p>the semantics of a partial read/write of where errors happen is currently unclear and may change</p> </details></div></div><div class='docblock'><p>Transforms this <code>Read</code> instance to an [<code>Iterator</code>] over [<code>char</code>]s. <a href="../../std/io/trait.Read.html#method.chars">Read more</a></p> </div><h4 id='method.chain' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><T, U></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><T, U></h3><code class="content"><span class="where fmt-newline">impl<T: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>, U: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>> <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><T, U></span></code></div></div><span id='chain.v' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.chain' class='fnname'>chain</a><R: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>>(self, next: R) -> <a class="struct" href="../../std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><Self, R> <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#869-871' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Creates an adaptor which will chain this stream with another. <a href="../../std/io/trait.Read.html#method.chain">Read more</a></p> </div><h4 id='method.take' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/io/struct.Take.html" title="struct std::io::Take">Take</a><T></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/io/struct.Take.html" title="struct std::io::Take">Take</a><T></h3><code class="content"><span class="where fmt-newline">impl<T: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>> <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/io/struct.Take.html" title="struct std::io::Take">Take</a><T></span></code></div></div><span id='take.v' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.take' class='fnname'>take</a>(self, limit: <a class="primitive" href="../primitive.u64.html">u64</a>) -> <a class="struct" href="../../std/io/struct.Take.html" title="struct std::io::Take">Take</a><Self> <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#905-907' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Creates an adaptor which will read at most <code>limit</code> bytes from it. <a href="../../std/io/trait.Read.html#method.take">Read more</a></p> </div></div><h3 id='impl-Write' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-Write' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#599-604' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.write' class="method"><span id='write.v' class='invisible'><code>fn <a href='../../std/io/trait.Write.html#tymethod.write' class='fnname'>write</a>(&mut self, buf: <a class="primitive" href="../primitive.slice.html">&[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#600-602' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Write a buffer into this object, returning how many bytes were written. <a href="../../std/io/trait.Write.html#tymethod.write">Read more</a></p> </div><h4 id='method.flush' class="method"><span id='flush.v' class='invisible'><code>fn <a href='../../std/io/trait.Write.html#tymethod.flush' class='fnname'>flush</a>(&mut self) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#603' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Flush this output stream, ensuring that all intermediately buffered contents reach their destination. <a href="../../std/io/trait.Write.html#tymethod.flush">Read more</a></p> </div><h4 id='method.write_all' class="method"><span id='write_all.v' class='invisible'><code>fn <a href='../../std/io/trait.Write.html#method.write_all' class='fnname'>write_all</a>(&mut self, buf: <a class="primitive" href="../primitive.slice.html">&[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#1097-1108' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Attempts to write an entire buffer into this write. <a href="../../std/io/trait.Write.html#method.write_all">Read more</a></p> </div><h4 id='method.write_fmt' class="method"><span id='write_fmt.v' class='invisible'><code>fn <a href='../../std/io/trait.Write.html#method.write_fmt' class='fnname'>write_fmt</a>(&mut self, fmt: <a class="struct" href="../../std/fmt/struct.Arguments.html" title="struct std::fmt::Arguments">Arguments</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#1149-1181' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Writes a formatted string into this writer, returning any error encountered. <a href="../../std/io/trait.Write.html#method.write_fmt">Read more</a></p> </div><h4 id='method.by_ref-1' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I</h3><code class="content"><span class="where fmt-newline">impl<'a, I> <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I <span class="where fmt-newline">where<br> I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></span><span class="where fmt-newline"> type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>>::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl<'a, R: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>> <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>R</span><span class="where fmt-newline">impl<'a, W: <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>> <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>W</span></code></div></div><span id='by_ref.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Write.html#method.by_ref' class='fnname'>by_ref</a>(&mut self) -> <a class="primitive" href="../primitive.reference.html">&mut </a>Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#1205' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Creates a "by reference" adaptor for this instance of <code>Write</code>. <a href="../../std/io/trait.Write.html#method.by_ref">Read more</a></p> </div></div><h3 id='impl-Seek' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/io/trait.Seek.html" title="trait std::io::Seek">Seek</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-Seek' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#606-610' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.seek' class="method"><span id='seek.v' class='invisible'><code>fn <a href='../../std/io/trait.Seek.html#tymethod.seek' class='fnname'>seek</a>(&mut self, pos: <a class="enum" href="../../std/io/enum.SeekFrom.html" title="enum std::io::SeekFrom">SeekFrom</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.u64.html">u64</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#607-609' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Seek to an offset, in bytes, in a stream. <a href="../../std/io/trait.Seek.html#tymethod.seek">Read more</a></p> </div></div><h3 id='impl-Read-1' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-Read-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#612-621' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.read-1' class="method"><span id='read.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#tymethod.read' class='fnname'>read</a>(&mut self, buf: <a class="primitive" href="../primitive.slice.html">&mut [</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#613-615' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Pull some bytes from this source into the specified buffer, returning how many bytes were read. <a href="../../std/io/trait.Read.html#tymethod.read">Read more</a></p> </div><h4 id='method.initializer-1' class="method"><span id='initializer.v-1' class='invisible'><code>unsafe fn <a href='../../std/io/trait.Read.html#method.initializer' class='fnname'>initializer</a>(&self) -> <a class="struct" href="../../std/io/struct.Initializer.html" title="struct std::io::Initializer">Initializer</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#618-620' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>read_initializer </code><a href="https://github.com/rust-lang/rust/issues/42788">#42788</a>)</div></div><div class='docblock'><p>Determines if this <code>Read</code>er can work with buffers of uninitialized memory. <a href="../../std/io/trait.Read.html#method.initializer">Read more</a></p> </div><h4 id='method.read_to_end-1' class="method"><span id='read_to_end.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.read_to_end' class='fnname'>read_to_end</a>(&mut self, buf: &mut <a class="struct" href="../../std/vec/struct.Vec.html" title="struct std::vec::Vec">Vec</a><<a class="primitive" href="../primitive.u8.html">u8</a>>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#600-602' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Read all bytes until EOF in this source, placing them into <code>buf</code>. <a href="../../std/io/trait.Read.html#method.read_to_end">Read more</a></p> </div><h4 id='method.read_to_string-1' class="method"><span id='read_to_string.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.read_to_string' class='fnname'>read_to_string</a>(&mut self, buf: &mut <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#638-649' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Read all bytes until EOF in this source, appending them to <code>buf</code>. <a href="../../std/io/trait.Read.html#method.read_to_string">Read more</a></p> </div><h4 id='method.read_exact-1' class="method"><span id='read_exact.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.read_exact' class='fnname'>read_exact</a>(&mut self, buf: <a class="primitive" href="../primitive.slice.html">&mut [</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.6.0'>1.6.0</div><a class='srclink' href='../../src/std/io/mod.rs.html#701-716' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Read the exact number of bytes required to fill <code>buf</code>. <a href="../../std/io/trait.Read.html#method.read_exact">Read more</a></p> </div><h4 id='method.by_ref-2' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I</h3><code class="content"><span class="where fmt-newline">impl<'a, I> <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I <span class="where fmt-newline">where<br> I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></span><span class="where fmt-newline"> type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>>::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl<'a, R: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>> <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>R</span><span class="where fmt-newline">impl<'a, W: <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>> <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>W</span></code></div></div><span id='by_ref.v-2' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.by_ref' class='fnname'>by_ref</a>(&mut self) -> <a class="primitive" href="../primitive.reference.html">&mut </a>Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#753' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Creates a "by reference" adaptor for this instance of <code>Read</code>. <a href="../../std/io/trait.Read.html#method.by_ref">Read more</a></p> </div><h4 id='method.bytes-1' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><R></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><R></h3><code class="content"><span class="where fmt-newline">impl<R: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>> <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><R></span><span class="where fmt-newline"> type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.u8.html">u8</a>>;</span></code></div></div><span id='bytes.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.bytes' class='fnname'>bytes</a>(self) -> <a class="struct" href="../../std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><Self> <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#790-792' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Transforms this <code>Read</code> instance to an [<code>Iterator</code>] over its bytes. <a href="../../std/io/trait.Read.html#method.bytes">Read more</a></p> </div><h4 id='method.chars-1' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/io/struct.Chars.html" title="struct std::io::Chars">Chars</a><R></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/io/struct.Chars.html" title="struct std::io::Chars">Chars</a><R></h3><code class="content"><span class="where fmt-newline">impl<R: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>> <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="struct" href="../../std/io/struct.Chars.html" title="struct std::io::Chars">Chars</a><R></span><span class="where fmt-newline"> type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.char.html">char</a>, <a class="enum" href="../../std/io/enum.CharsError.html" title="enum std::io::CharsError">CharsError</a>>;</span></code></div></div><span id='chars.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.chars' class='fnname'>chars</a>(self) -> <a class="struct" href="../../std/io/struct.Chars.html" title="struct std::io::Chars">Chars</a><Self> <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#834-836' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>io </code><a href="https://github.com/rust-lang/rust/issues/27802">#27802</a>)</summary><p>the semantics of a partial read/write of where errors happen is currently unclear and may change</p> </details></div></div><div class='docblock'><p>Transforms this <code>Read</code> instance to an [<code>Iterator</code>] over [<code>char</code>]s. <a href="../../std/io/trait.Read.html#method.chars">Read more</a></p> </div><h4 id='method.chain-1' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><T, U></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><T, U></h3><code class="content"><span class="where fmt-newline">impl<T: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>, U: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>> <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><T, U></span></code></div></div><span id='chain.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.chain' class='fnname'>chain</a><R: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>>(self, next: R) -> <a class="struct" href="../../std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><Self, R> <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#869-871' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Creates an adaptor which will chain this stream with another. <a href="../../std/io/trait.Read.html#method.chain">Read more</a></p> </div><h4 id='method.take-1' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../std/io/struct.Take.html" title="struct std::io::Take">Take</a><T></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../../std/io/struct.Take.html" title="struct std::io::Take">Take</a><T></h3><code class="content"><span class="where fmt-newline">impl<T: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a>> <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/io/struct.Take.html" title="struct std::io::Take">Take</a><T></span></code></div></div><span id='take.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Read.html#method.take' class='fnname'>take</a>(self, limit: <a class="primitive" href="../primitive.u64.html">u64</a>) -> <a class="struct" href="../../std/io/struct.Take.html" title="struct std::io::Take">Take</a><Self> <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#905-907' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Creates an adaptor which will read at most <code>limit</code> bytes from it. <a href="../../std/io/trait.Read.html#method.take">Read more</a></p> </div></div><h3 id='impl-Write-1' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-Write-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#623-628' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.write-1' class="method"><span id='write.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Write.html#tymethod.write' class='fnname'>write</a>(&mut self, buf: <a class="primitive" href="../primitive.slice.html">&[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#624-626' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Write a buffer into this object, returning how many bytes were written. <a href="../../std/io/trait.Write.html#tymethod.write">Read more</a></p> </div><h4 id='method.flush-1' class="method"><span id='flush.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Write.html#tymethod.flush' class='fnname'>flush</a>(&mut self) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#627' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Flush this output stream, ensuring that all intermediately buffered contents reach their destination. <a href="../../std/io/trait.Write.html#tymethod.flush">Read more</a></p> </div><h4 id='method.write_all-1' class="method"><span id='write_all.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Write.html#method.write_all' class='fnname'>write_all</a>(&mut self, buf: <a class="primitive" href="../primitive.slice.html">&[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#1097-1108' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Attempts to write an entire buffer into this write. <a href="../../std/io/trait.Write.html#method.write_all">Read more</a></p> </div><h4 id='method.write_fmt-1' class="method"><span id='write_fmt.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Write.html#method.write_fmt' class='fnname'>write_fmt</a>(&mut self, fmt: <a class="struct" href="../../std/fmt/struct.Arguments.html" title="struct std::fmt::Arguments">Arguments</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#1149-1181' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Writes a formatted string into this writer, returning any error encountered. <a href="../../std/io/trait.Write.html#method.write_fmt">Read more</a></p> </div><h4 id='method.by_ref-3' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I</h3><code class="content"><span class="where fmt-newline">impl<'a, I> <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>I <span class="where fmt-newline">where<br> I: <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></span><span class="where fmt-newline"> type <a href='../../std/iter/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <I as <a class="trait" href="../../std/iter/trait.Iterator.html" title="trait std::iter::Iterator">Iterator</a>>::<a class="type" href="../../std/iter/trait.Iterator.html#associatedtype.Item" title="type std::iter::Iterator::Item">Item</a>;</span><span class="where fmt-newline">impl<'a, R: <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>> <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>R</span><span class="where fmt-newline">impl<'a, W: <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>> <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="../primitive.reference.html">&'a mut </a>W</span></code></div></div><span id='by_ref.v-3' class='invisible'><code>fn <a href='../../std/io/trait.Write.html#method.by_ref' class='fnname'>by_ref</a>(&mut self) -> <a class="primitive" href="../primitive.reference.html">&mut </a>Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/io/mod.rs.html#1205' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Creates a "by reference" adaptor for this instance of <code>Write</code>. <a href="../../std/io/trait.Write.html#method.by_ref">Read more</a></p> </div></div><h3 id='impl-Seek-1' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="../../std/io/trait.Seek.html" title="trait std::io::Seek">Seek</a> for &'a <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-Seek-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#630-634' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.seek-1' class="method"><span id='seek.v-1' class='invisible'><code>fn <a href='../../std/io/trait.Seek.html#tymethod.seek' class='fnname'>seek</a>(&mut self, pos: <a class="enum" href="../../std/io/enum.SeekFrom.html" title="enum std::io::SeekFrom">SeekFrom</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.u64.html">u64</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/fs.rs.html#631-633' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Seek to an offset, in bytes, in a stream. <a href="../../std/io/trait.Seek.html#tymethod.seek">Read more</a></p> </div></div><h3 id='impl-From%3CFile%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a><<a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a>> for <a class="struct" href="../../std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a></code><a href='#impl-From%3CFile%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.20.0'>1.20.0</div><a class='srclink' href='../../src/std/process.rs.html#996-1000' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.from' class="method"><span id='from.v' class='invisible'><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(file: <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a>) -> <a class="struct" href="../../std/process/struct.Stdio.html" title="struct std::process::Stdio">Stdio</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/process.rs.html#997-999' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Performs the conversion.</p> </div></div><h3 id='impl-AsRawFd' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/os/unix/io/trait.AsRawFd.html" title="trait std::os::unix::io::AsRawFd">AsRawFd</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-AsRawFd' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/unix/ext/io.rs.html#77-81' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.as_raw_fd' class="method"><span id='as_raw_fd.v' class='invisible'><code>fn <a href='../../std/os/unix/io/trait.AsRawFd.html#tymethod.as_raw_fd' class='fnname'>as_raw_fd</a>(&self) -> <a class="type" href="../../std/os/unix/io/type.RawFd.html" title="type std::os::unix::io::RawFd">RawFd</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/unix/ext/io.rs.html#78-80' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab portability'>This is supported on <strong>Unix</strong> only.</div></div><div class='docblock'><p>Extracts the raw file descriptor. <a href="../../std/os/unix/io/trait.AsRawFd.html#tymethod.as_raw_fd">Read more</a></p> </div></div><h3 id='impl-FromRawFd' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/os/unix/io/trait.FromRawFd.html" title="trait std::os::unix::io::FromRawFd">FromRawFd</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-FromRawFd' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.1.0'>1.1.0</div><a class='srclink' href='../../src/std/sys/unix/ext/io.rs.html#83-87' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.from_raw_fd' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../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="../../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="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></span></code></div></div><span id='from_raw_fd.v' class='invisible'><code>unsafe fn <a href='../../std/os/unix/io/trait.FromRawFd.html#tymethod.from_raw_fd' class='fnname'>from_raw_fd</a>(fd: <a class="type" href="../../std/os/unix/io/type.RawFd.html" title="type std::os::unix::io::RawFd">RawFd</a>) -> <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/unix/ext/io.rs.html#84-86' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab portability'>This is supported on <strong>Unix</strong> only.</div></div><div class='docblock'><p>Constructs a new instance of <code>Self</code> from the given raw file descriptor. <a href="../../std/os/unix/io/trait.FromRawFd.html#tymethod.from_raw_fd">Read more</a></p> </div></div><h3 id='impl-IntoRawFd' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/os/unix/io/trait.IntoRawFd.html" title="trait std::os::unix::io::IntoRawFd">IntoRawFd</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-IntoRawFd' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.4.0'>1.4.0</div><a class='srclink' href='../../src/std/sys/unix/ext/io.rs.html#89-93' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.into_raw_fd' class="method"><span id='into_raw_fd.v' class='invisible'><code>fn <a href='../../std/os/unix/io/trait.IntoRawFd.html#tymethod.into_raw_fd' class='fnname'>into_raw_fd</a>(self) -> <a class="type" href="../../std/os/unix/io/type.RawFd.html" title="type std::os::unix::io::RawFd">RawFd</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/unix/ext/io.rs.html#90-92' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab portability'>This is supported on <strong>Unix</strong> only.</div></div><div class='docblock'><p>Consumes this object, returning the raw underlying file descriptor. <a href="../../std/os/unix/io/trait.IntoRawFd.html#tymethod.into_raw_fd">Read more</a></p> </div></div><h3 id='impl-FileExt' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/os/unix/fs/trait.FileExt.html" title="trait std::os::unix::fs::FileExt">FileExt</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-FileExt' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.15.0'>1.15.0</div><a class='srclink' href='../../src/std/sys/unix/ext/fs.rs.html#99-106' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.read_at' class="method"><span id='read_at.v' class='invisible'><code>fn <a href='../../std/os/unix/fs/trait.FileExt.html#tymethod.read_at' class='fnname'>read_at</a>(&self, buf: <a class="primitive" href="../primitive.slice.html">&mut [</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>, offset: <a class="primitive" href="../primitive.u64.html">u64</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/unix/ext/fs.rs.html#100-102' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab portability'>This is supported on <strong>Unix</strong> only.</div></div><div class='docblock'><p>Reads a number of bytes starting from a given offset. <a href="../../std/os/unix/fs/trait.FileExt.html#tymethod.read_at">Read more</a></p> </div><h4 id='method.write_at' class="method"><span id='write_at.v' class='invisible'><code>fn <a href='../../std/os/unix/fs/trait.FileExt.html#tymethod.write_at' class='fnname'>write_at</a>(&self, buf: <a class="primitive" href="../primitive.slice.html">&[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>, offset: <a class="primitive" href="../primitive.u64.html">u64</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/unix/ext/fs.rs.html#103-105' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab portability'>This is supported on <strong>Unix</strong> only.</div></div><div class='docblock'><p>Writes a number of bytes starting from a given offset. <a href="../../std/os/unix/fs/trait.FileExt.html#tymethod.write_at">Read more</a></p> </div></div><h3 id='impl-FileExt-1' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/os/windows/fs/trait.FileExt.html" title="trait std::os::windows::fs::FileExt">FileExt</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-FileExt-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.15.0'>1.15.0</div><a class='srclink' href='../../src/std/sys/windows/ext/fs.rs.html#96-104' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.seek_read' class="method"><span id='seek_read.v' class='invisible'><code>fn <a href='../../std/os/windows/fs/trait.FileExt.html#tymethod.seek_read' class='fnname'>seek_read</a>(&self, buf: <a class="primitive" href="../primitive.slice.html">&mut [</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>, offset: <a class="primitive" href="../primitive.u64.html">u64</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/windows/ext/fs.rs.html#97-99' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab portability'>This is supported on <strong>Windows</strong> only.</div></div><div class='docblock'><p>Seeks to a given position and reads a number of bytes. <a href="../../std/os/windows/fs/trait.FileExt.html#tymethod.seek_read">Read more</a></p> </div><h4 id='method.seek_write' class="method"><span id='seek_write.v' class='invisible'><code>fn <a href='../../std/os/windows/fs/trait.FileExt.html#tymethod.seek_write' class='fnname'>seek_write</a>(&self, buf: <a class="primitive" href="../primitive.slice.html">&[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.slice.html">]</a>, offset: <a class="primitive" href="../primitive.u64.html">u64</a>) -> <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a><<a class="primitive" href="../primitive.usize.html">usize</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/windows/ext/fs.rs.html#101-103' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab portability'>This is supported on <strong>Windows</strong> only.</div></div><div class='docblock'><p>Seeks to a given position and writes a number of bytes. <a href="../../std/os/windows/fs/trait.FileExt.html#tymethod.seek_write">Read more</a></p> </div></div><h3 id='impl-AsRawHandle' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/os/windows/io/trait.AsRawHandle.html" title="trait std::os::windows::io::AsRawHandle">AsRawHandle</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-AsRawHandle' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/windows/ext/io.rs.html#69-73' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.as_raw_handle' class="method"><span id='as_raw_handle.v' class='invisible'><code>fn <a href='../../std/os/windows/io/trait.AsRawHandle.html#tymethod.as_raw_handle' class='fnname'>as_raw_handle</a>(&self) -> <a class="type" href="../../std/os/windows/io/type.RawHandle.html" title="type std::os::windows::io::RawHandle">RawHandle</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/windows/ext/io.rs.html#70-72' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab portability'>This is supported on <strong>Windows</strong> only.</div></div><div class='docblock'><p>Extracts the raw handle, without taking any ownership.</p> </div></div><h3 id='impl-FromRawHandle' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/os/windows/io/trait.FromRawHandle.html" title="trait std::os::windows::io::FromRawHandle">FromRawHandle</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-FromRawHandle' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.1.0'>1.1.0</div><a class='srclink' href='../../src/std/sys/windows/ext/io.rs.html#97-102' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.from_raw_handle' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../../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="../../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="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="../../std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="../../std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></span></code></div></div><span id='from_raw_handle.v' class='invisible'><code>unsafe fn <a href='../../std/os/windows/io/trait.FromRawHandle.html#tymethod.from_raw_handle' class='fnname'>from_raw_handle</a>(handle: <a class="type" href="../../std/os/windows/io/type.RawHandle.html" title="type std::os::windows::io::RawHandle">RawHandle</a>) -> <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/windows/ext/io.rs.html#98-101' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab portability'>This is supported on <strong>Windows</strong> only.</div></div><div class='docblock'><p>Constructs a new I/O object from the specified raw handle. <a href="../../std/os/windows/io/trait.FromRawHandle.html#tymethod.from_raw_handle">Read more</a></p> </div></div><h3 id='impl-IntoRawHandle' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/os/windows/io/trait.IntoRawHandle.html" title="trait std::os::windows::io::IntoRawHandle">IntoRawHandle</a> for <a class="struct" href="../../std/fs/struct.File.html" title="struct std::fs::File">File</a></code><a href='#impl-IntoRawHandle' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.4.0'>1.4.0</div><a class='srclink' href='../../src/std/sys/windows/ext/io.rs.html#105-109' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.into_raw_handle' class="method"><span id='into_raw_handle.v' class='invisible'><code>fn <a href='../../std/os/windows/io/trait.IntoRawHandle.html#tymethod.into_raw_handle' class='fnname'>into_raw_handle</a>(self) -> <a class="type" href="../../std/os/windows/io/type.RawHandle.html" title="type std::os::windows::io::RawHandle">RawHandle</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/sys/windows/ext/io.rs.html#106-108' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab portability'>This is supported on <strong>Windows</strong> only.</div></div><div class='docblock'><p>Consumes this object, returning the raw underlying handle. <a href="../../std/os/windows/io/trait.IntoRawHandle.html#tymethod.into_raw_handle">Read more</a></p> </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> </div> </div> </aside> <script> window.rootPath = "../../"; window.currentCrate = "std"; </script> <script src="../../main.js"></script> <script defer src="../../search-index.js"></script> </body> </html>