<main><divclass="width-limiter"><navclass="sub"><formclass="search-form"><span></span><divid="sidebar-button"tabindex="-1"><ahref="../walkdir/all.html"title="show sidebar"></a></div><inputclass="search-input"name="search"aria-label="Run search in the documentation"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"><divid="help-button"tabindex="-1"><ahref="../help.html"title="help">?</a></div><divid="settings-menu"tabindex="-1"><ahref="../settings.html"title="settings"><imgwidth="22"height="22"alt="Change settings"src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><sectionid="main-content"class="content"><divclass="main-heading"><h1>Struct <ahref="index.html">walkdir</a>::<wbr><aclass="struct"href="#">Error</a><buttonid="copy-path"title="Copy item path to clipboard"><imgsrc="../static.files/clipboard-7571035ce49a181d.svg"width="19"height="18"alt="Copy item path"></button></h1><spanclass="out-of-band"><aclass="src"href="../src/walkdir/error.rs.html#28-31">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><preclass="rust item-decl"><code>pub struct Error { <spanclass="comment">/* private fields */</span> }</code></pre><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>An error produced by recursively walking a directory.</p>
<p>This error type is a light wrapper around <ahref="https://doc.rust-lang.org/stable/std/io/struct.Error.html"><code>std::io::Error</code></a>. In
particular, it adds the following information:</p>
<ul>
<li>The depth at which the error occurred in the file tree, relative to the
root.</li>
<li>The path, if any, associated with the IO error.</li>
<li>An indication that a loop occurred when following symbolic links. In this
case, there is no underlying IO error.</li>
</ul>
<p>To maintain good ergonomics, this type has a
<ahref="struct.Error.html#impl-From%3CError%3E"><code>impl From<Error> for std::io::Error</code></a> defined which preserves the original context.
This allows you to use an <ahref="https://doc.rust-lang.org/stable/std/io/type.Result.html"><code>io::Result</code></a> with methods in this crate if you don’t care about
accessing the underlying error data in a structured form.</p>
</div></details><h2id="implementations"class="section-header">Implementations<ahref="#implementations"class="anchor">§</a></h2><divid="implementations-list"><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Error"class="impl"><aclass="src rightside"href="../src/walkdir/error.rs.html#39-197">source</a><ahref="#impl-Error"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.Error.html"title="struct walkdir::Error">Error</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.path"class="method"><aclass="src rightside"href="../src/walkdir/error.rs.html#46-52">source</a><h4class="code-header">pub fn <ahref="#method.path"class="fn">path</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&<aclass="struct"href="https://doc.rust-lang.org/1.78.0/std/path/struct.Path.html"title="struct std::path::Path">Path</a>></h4></section></summary><divclass="docblock"><p>Returns the path associated with this error if one exists.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.loop_ancestor"class="method"><aclass="src rightside"href="../src/walkdir/error.rs.html#66-71">source</a><h4class="code-header">pub fn <ahref="#method.loop_ancestor"class="fn">loop_ancestor</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&<aclass="struct"href="https://doc.rust-lang.org/1.78.0/std/path/struct.Path.html"title="struct std::path::Path">Path</a>></h4></section></summary><divclass="docblock"><p>Returns the path at which a cycle was detected.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.depth"class="method"><aclass="src rightside"href="../src/walkdir/error.rs.html#81-83">source</a><h4class="code-header">pub fn <ahref="#method.depth"class="fn">depth</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.78.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the depth at which this error occurred relative to the root.</p>
<p>The smallest depth is <code>0</code> and always corresponds to the path given to
the <ahref="struct.WalkDir.html#method.new"><code>new</code></a> function on <ahref="struct.WalkDir.html"><code>WalkDir</code></a>. Its direct descendents have depth
<code>1</code>, and their descendents have depth <code>2</code>, and so on.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.io_error"class="method"><aclass="src rightside"href="../src/walkdir/error.rs.html#143-148">source</a><h4class="code-header">pub fn <ahref="#method.io_error"class="fn">io_error</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&<aclass="struct"href="https://doc.rust-lang.org/1.78.0/std/io/error/struct.Error.html"title="struct std::io::error::Error">Error</a>></h4></section></summary><divclass="docblock"><p>Inspect the original <ahref="https://doc.rust-lang.org/stable/std/io/struct.Error.html"><code>io::Error</code></a> if there is one.</p>
<p><ahref="https://doc.rust-lang.org/stable/std/option/enum.Option.html#variant.None"><code>None</code></a> is returned if the <ahref="struct.Error.html"><code>Error</code></a> doesn’t correspond to an
<ahref="https://doc.rust-lang.org/stable/std/io/struct.Error.html"><code>io::Error</code></a>. This might happen, for example, when the error was
produced because a cycle was found in the directory tree while
following symbolic links.</p>
<p>This method returns a borrowed value that is bound to the lifetime of the <ahref="struct.Error.html"><code>Error</code></a>. To
obtain an owned value, the <ahref="struct.Error.html#method.into_io_error"><code>into_io_error</code></a> can be used instead.</p>
<blockquote>
<p>This is the original <ahref="https://doc.rust-lang.org/stable/std/io/struct.Error.html"><code>io::Error</code></a> and is <em>not</em> the same as
<ahref="struct.Error.html#impl-From%3CError%3E"><code>impl From<Error> for std::io::Error</code></a> which contains additional context about the
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.into_io_error"class="method"><aclass="src rightside"href="../src/walkdir/error.rs.html#155-160">source</a><h4class="code-header">pub fn <ahref="#method.into_io_error"class="fn">into_io_error</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="https://doc.rust-lang.org/1.78.0/std/io/error/struct.Error.html"title="struct std::io::error::Error">Error</a>></h4></section></summary><divclass="docblock"><p>Similar to <ahref="struct.Error.html#method.io_error"><code>io_error</code></a> except consumes self to convert to the original
</div></details></div></details></div><h2id="trait-implementations"class="section-header">Trait Implementations<ahref="#trait-implementations"class="anchor">§</a></h2><divid="trait-implementations-list"><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Debug-for-Error"class="impl"><aclass="src rightside"href="../src/walkdir/error.rs.html#27">source</a><ahref="#impl-Debug-for-Error"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/fmt/trait.Debug.html"title="trait core::fmt::Debug">Debug</a> for <aclass="struct"href="struct.Error.html"title="struct walkdir::Error">Error</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.fmt"class="method trait-impl"><aclass="src rightside"href="../src/walkdir/error.rs.html#27">source</a><ahref="#method.fmt"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.78.0/core/fmt/trait.Debug.html#tymethod.fmt"class="fn">fmt</a>(&self, f: &mut <aclass="struct"href="https://doc.rust-lang.org/1.78.0/core/fmt/struct.Formatter.html"title="struct core::fmt::Formatter">Formatter</a><'_>) -><aclass="type"href="https://doc.rust-lang.org/1.78.0/core/fmt/type.Result.html"title="type core::fmt::Result">Result</a></h4></section></summary><divclass='docblock'>Formats the value using the given formatter. <ahref="https://doc.rust-lang.org/1.78.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Display-for-Error"class="impl"><aclass="src rightside"href="../src/walkdir/error.rs.html#220-239">source</a><ahref="#impl-Display-for-Error"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/fmt/trait.Display.html"title="trait core::fmt::Display">Display</a> for <aclass="struct"href="struct.Error.html"title="struct walkdir::Error">Error</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.fmt-1"class="method trait-impl"><aclass="src rightside"href="../src/walkdir/error.rs.html#221-238">source</a><ahref="#method.fmt-1"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.78.0/core/fmt/trait.Display.html#tymethod.fmt"class="fn">fmt</a>(&self, f: &mut <aclass="struct"href="https://doc.rust-lang.org/1.78.0/core/fmt/struct.Formatter.html"title="struct core::fmt::Formatter">Formatter</a><'_>) -><aclass="type"href="https://doc.rust-lang.org/1.78.0/core/fmt/type.Result.html"title="type core::fmt::Result">Result</a></h4></section></summary><divclass='docblock'>Formats the value using the given formatter. <ahref="https://doc.rust-lang.org/1.78.0/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Error-for-Error"class="impl"><aclass="src rightside"href="../src/walkdir/error.rs.html#199-218">source</a><ahref="#impl-Error-for-Error"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/error/trait.Error.html"title="trait core::error::Error">Error</a> for <aclass="struct"href="struct.Error.html"title="struct walkdir::Error">Error</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.description"class="method trait-impl"><aclass="src rightside"href="../src/walkdir/error.rs.html#201-206">source</a><ahref="#method.description"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.78.0/core/error/trait.Error.html#method.description"class="fn">description</a>(&self) ->&<aclass="primitive"href="https://doc.rust-lang.org/1.78.0/std/primitive.str.html">str</a></h4></section></summary><spanclass="item-info"><
<ahref="struct.Error.html"><code>Error</code></a> as the <ahref="https://doc.rust-lang.org/std/io/struct.Error.html#method.into_inner">“inner error”</a>. Note that this also makes the display
of the error include the context.</p>
<p>This is different from <ahref="struct.WalkDir.html#method.into_io_error"><code>into_io_error</code></a> which returns the original
<code><ahref="https://doc.rust-lang.org/1.78.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-ToString-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/alloc/string.rs.html#2543">source</a><ahref="#impl-ToString-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.78.0/alloc/string/trait.ToString.html"title="trait alloc::string::ToString">ToString</a> for T<divclass="where">where
T: <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/fmt/trait.Display.html"title="trait core::fmt::Display">Display</a> + ?<aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.to_string"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/alloc/string.rs.html#2549">source</a><ahref="#method.to_string"class="anchor">§</a><h4class="code-header">default fn <ahref="https://doc.rust-lang.org/1.78.0/alloc/string/trait.ToString.html#tymethod.to_string"class="fn">to_string</a>(&self) -><aclass="struct"href="https://doc.rust-lang.org/1.78.0/alloc/string/struct.String.html"title="struct alloc::string::String">String</a></h4></section></summary><divclass='docblock'>Converts the given value to a <code>String</code>. <ahref="https://doc.rust-lang.org/1.78.0/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryFrom%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/core/convert/mod.rs.html#805-807">source</a><ahref="#impl-TryFrom%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/convert/enum.Infallible.html"title="enum core::convert::Infallible">Infallible</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/core/convert/mod.rs.html#812">source</a><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html#tymethod.try_from"class="fn">try_from</a>(value: U) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><T, <T as <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/core/convert/mod.rs.html#790-792">source</a><ahref="#impl-TryInto%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryInto.html"title="trait core::convert::TryInto">TryInto</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryInto.html#associatedtype.Error"class="associatedtype">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/core/convert/mod.rs.html#797">source</a><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryInto.html#tymethod.try_into"class="fn">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><U, <U as <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>