mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-23 00:18:24 +00:00
192 lines
42 KiB
HTML
192 lines
42 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A builder to create an iterator for recursively walking a directory."><title>WalkDir in walkdir - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-5bc39a1768837dd0.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="walkdir" data-themes="" data-resource-suffix="" data-rustdoc-version="1.77.2 (25ef9e3d8 2024-04-09)" data-channel="1.77.2" data-search-js="search-dd67cee4cfa65049.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-4c98445ec4002617.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-48f368f3872407c8.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-04d5337699b92874.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../walkdir/index.html">walkdir</a><span class="version">2.5.0</span></h2></div><h2 class="location"><a href="#">WalkDir</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.contents_first">contents_first</a></li><li><a href="#method.follow_links">follow_links</a></li><li><a href="#method.follow_root_links">follow_root_links</a></li><li><a href="#method.max_depth">max_depth</a></li><li><a href="#method.max_open">max_open</a></li><li><a href="#method.min_depth">min_depth</a></li><li><a href="#method.new">new</a></li><li><a href="#method.same_file_system">same_file_system</a></li><li><a href="#method.sort_by">sort_by</a></li><li><a href="#method.sort_by_file_name">sort_by_file_name</a></li><li><a href="#method.sort_by_key">sort_by_key</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-WalkDir">Debug</a></li><li><a href="#impl-IntoIterator-for-WalkDir">IntoIterator</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-WalkDir">!RefUnwindSafe</a></li><li><a href="#impl-UnwindSafe-for-WalkDir">!UnwindSafe</a></li><li><a href="#impl-Send-for-WalkDir">Send</a></li><li><a href="#impl-Sync-for-WalkDir">Sync</a></li><li><a href="#impl-Unpin-for-WalkDir">Unpin</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In crate walkdir</a></h2></div></nav><div class="sidebar-resizer"></div>
|
||
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../walkdir/all.html" title="show sidebar"></a></div><input class="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"><div id="help-button" tabindex="-1"><a href="../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="index.html">walkdir</a>::<wbr><a class="struct" href="#">WalkDir</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../src/walkdir/lib.rs.html#234-237">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct WalkDir { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A builder to create an iterator for recursively walking a directory.</p>
|
||
<p>Results are returned in depth first fashion, with directories yielded
|
||
before their contents. If <a href="struct.WalkDir.html#method.contents_first"><code>contents_first</code></a> is true, contents are yielded
|
||
before their directories. The order is unspecified but if <a href="struct.WalkDir.html#method.sort_by"><code>sort_by</code></a> is
|
||
given, directory entries are sorted according to this function. Directory
|
||
entries <code>.</code> and <code>..</code> are always omitted.</p>
|
||
<p>If an error occurs at any point during iteration, then it is returned in
|
||
place of its corresponding directory entry and iteration continues as
|
||
normal. If an error occurs while opening a directory for reading, then it
|
||
is not descended into (but the error is still yielded by the iterator).
|
||
Iteration may be stopped at any time. When the iterator is destroyed, all
|
||
resources associated with it are freed.</p>
|
||
<h2 id="usage"><a class="doc-anchor" href="#usage">§</a>Usage</h2>
|
||
<p>This type implements <a href="https://doc.rust-lang.org/stable/std/iter/trait.IntoIterator.html"><code>IntoIterator</code></a> so that it may be used as the subject
|
||
of a <code>for</code> loop. You may need to call <a href="https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html#tymethod.into_iter"><code>into_iter</code></a> explicitly if you want
|
||
to use iterator adapters such as <a href="struct.IntoIter.html#method.filter_entry"><code>filter_entry</code></a>.</p>
|
||
<p>Idiomatic use of this type should use method chaining to set desired
|
||
options. For example, this only shows entries with a depth of <code>1</code>, <code>2</code> or
|
||
<code>3</code> (relative to <code>foo</code>):</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>walkdir::WalkDir;
|
||
|
||
<span class="kw">for </span>entry <span class="kw">in </span>WalkDir::new(<span class="string">"foo"</span>).min_depth(<span class="number">1</span>).max_depth(<span class="number">3</span>) {
|
||
<span class="macro">println!</span>(<span class="string">"{}"</span>, entry<span class="question-mark">?</span>.path().display());
|
||
}</code></pre></div>
|
||
<p>Note that the iterator by default includes the top-most directory. Since
|
||
this is the only directory yielded with depth <code>0</code>, it is easy to ignore it
|
||
with the <a href="struct.WalkDir.html#method.min_depth"><code>min_depth</code></a> setting:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>walkdir::WalkDir;
|
||
|
||
<span class="kw">for </span>entry <span class="kw">in </span>WalkDir::new(<span class="string">"foo"</span>).min_depth(<span class="number">1</span>) {
|
||
<span class="macro">println!</span>(<span class="string">"{}"</span>, entry<span class="question-mark">?</span>.path().display());
|
||
}</code></pre></div>
|
||
<p>This will only return descendents of the <code>foo</code> directory and not <code>foo</code>
|
||
itself.</p>
|
||
<h2 id="loops"><a class="doc-anchor" href="#loops">§</a>Loops</h2>
|
||
<p>This iterator (like most/all recursive directory iterators) assumes that
|
||
no loops can be made with <em>hard</em> links on your file system. In particular,
|
||
this would require creating a hard link to a directory such that it creates
|
||
a loop. On most platforms, this operation is illegal.</p>
|
||
<p>Note that when following symbolic/soft links, loops are detected and an
|
||
error is reported.</p>
|
||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-WalkDir" class="impl"><a class="src rightside" href="../src/walkdir/lib.rs.html#281-534">source</a><a href="#impl-WalkDir" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.WalkDir.html" title="struct walkdir::WalkDir">WalkDir</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/walkdir/lib.rs.html#289-303">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a><P: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/1.77.2/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>>(root: P) -> Self</h4></section></summary><div class="docblock"><p>Create a builder for a recursive directory iterator starting at the
|
||
file path <code>root</code>. If <code>root</code> is a directory, then it is the first item
|
||
yielded by the iterator. If <code>root</code> is a file, then it is the first
|
||
and only item yielded by the iterator. If <code>root</code> is a symlink, then it
|
||
is always followed for the purposes of directory traversal. (A root
|
||
<code>DirEntry</code> still obeys its documentation with respect to symlinks and
|
||
the <code>follow_links</code> setting.)</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.min_depth" class="method"><a class="src rightside" href="../src/walkdir/lib.rs.html#310-316">source</a><h4 class="code-header">pub fn <a href="#method.min_depth" class="fn">min_depth</a>(self, depth: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.usize.html">usize</a>) -> Self</h4></section></summary><div class="docblock"><p>Set the minimum depth of entries yielded by the iterator.</p>
|
||
<p>The smallest depth is <code>0</code> and always corresponds to the path given
|
||
to the <code>new</code> function on this type. Its direct descendents have depth
|
||
<code>1</code>, and their descendents have depth <code>2</code>, and so on.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.max_depth" class="method"><a class="src rightside" href="../src/walkdir/lib.rs.html#327-333">source</a><h4 class="code-header">pub fn <a href="#method.max_depth" class="fn">max_depth</a>(self, depth: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.usize.html">usize</a>) -> Self</h4></section></summary><div class="docblock"><p>Set the maximum depth of entries yield by the iterator.</p>
|
||
<p>The smallest depth is <code>0</code> and always corresponds to the path given
|
||
to the <code>new</code> function on this type. Its direct descendents have depth
|
||
<code>1</code>, and their descendents have depth <code>2</code>, and so on.</p>
|
||
<p>Note that this will not simply filter the entries of the iterator, but
|
||
it will actually avoid descending into directories when the depth is
|
||
exceeded.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.follow_links" class="method"><a class="src rightside" href="../src/walkdir/lib.rs.html#346-349">source</a><h4 class="code-header">pub fn <a href="#method.follow_links" class="fn">follow_links</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -> Self</h4></section></summary><div class="docblock"><p>Follow symbolic links. By default, this is disabled.</p>
|
||
<p>When <code>yes</code> is <code>true</code>, symbolic links are followed as if they were
|
||
normal directories and files. If a symbolic link is broken or is
|
||
involved in a loop, an error is yielded.</p>
|
||
<p>When enabled, the yielded <a href="struct.DirEntry.html"><code>DirEntry</code></a> values represent the target of
|
||
the link while the path corresponds to the link. See the <a href="struct.DirEntry.html"><code>DirEntry</code></a>
|
||
type for more details.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.follow_root_links" class="method"><a class="src rightside" href="../src/walkdir/lib.rs.html#365-368">source</a><h4 class="code-header">pub fn <a href="#method.follow_root_links" class="fn">follow_root_links</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -> Self</h4></section></summary><div class="docblock"><p>Follow symbolic links if these are the root of the traversal.
|
||
By default, this is enabled.</p>
|
||
<p>When <code>yes</code> is <code>true</code>, symbolic links on root paths are followed
|
||
which is effective if the symbolic link points to a directory.
|
||
If a symbolic link is broken or is involved in a loop, an error is yielded
|
||
as the first entry of the traversal.</p>
|
||
<p>When enabled, the yielded <a href="struct.DirEntry.html"><code>DirEntry</code></a> values represent the target of
|
||
the link while the path corresponds to the link. See the <a href="struct.DirEntry.html"><code>DirEntry</code></a>
|
||
type for more details, and all future entries will be contained within
|
||
the resolved directory behind the symbolic link of the root path.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.max_open" class="method"><a class="src rightside" href="../src/walkdir/lib.rs.html#395-401">source</a><h4 class="code-header">pub fn <a href="#method.max_open" class="fn">max_open</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.usize.html">usize</a>) -> Self</h4></section></summary><div class="docblock"><p>Set the maximum number of simultaneously open file descriptors used
|
||
by the iterator.</p>
|
||
<p><code>n</code> must be greater than or equal to <code>1</code>. If <code>n</code> is <code>0</code>, then it is set
|
||
to <code>1</code> automatically. If this is not set, then it defaults to some
|
||
reasonably low number.</p>
|
||
<p>This setting has no impact on the results yielded by the iterator
|
||
(even when <code>n</code> is <code>1</code>). Instead, this setting represents a trade off
|
||
between scarce resources (file descriptors) and memory. Namely, when
|
||
the maximum number of file descriptors is reached and a new directory
|
||
needs to be opened to continue iteration, then a previous directory
|
||
handle is closed and has its unyielded entries stored in memory. In
|
||
practice, this is a satisfying trade off because it scales with respect
|
||
to the <em>depth</em> of your file tree. Therefore, low values (even <code>1</code>) are
|
||
acceptable.</p>
|
||
<p>Note that this value does not impact the number of system calls made by
|
||
an exhausted iterator.</p>
|
||
<h5 id="platform-behavior"><a class="doc-anchor" href="#platform-behavior">§</a>Platform behavior</h5>
|
||
<p>On Windows, if <code>follow_links</code> is enabled, then this limit is not
|
||
respected. In particular, the maximum number of file descriptors opened
|
||
is proportional to the depth of the directory tree traversed.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.sort_by" class="method"><a class="src rightside" href="../src/walkdir/lib.rs.html#417-423">source</a><h4 class="code-header">pub fn <a href="#method.sort_by" class="fn">sort_by</a><F>(self, cmp: F) -> Self<div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&<a class="struct" href="struct.DirEntry.html" title="struct walkdir::DirEntry">DirEntry</a>, &<a class="struct" href="struct.DirEntry.html" title="struct walkdir::DirEntry">DirEntry</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a> + <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,</div></h4></section></summary><div class="docblock"><p>Set a function for sorting directory entries with a comparator
|
||
function.</p>
|
||
<p>If a compare function is set, the resulting iterator will return all
|
||
paths in sorted order. The compare function will be called to compare
|
||
entries from the same directory.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::cmp;
|
||
<span class="kw">use </span>std::ffi::OsString;
|
||
<span class="kw">use </span>walkdir::WalkDir;
|
||
|
||
WalkDir::new(<span class="string">"foo"</span>).sort_by(|a,b| a.file_name().cmp(b.file_name()));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.sort_by_key" class="method"><a class="src rightside" href="../src/walkdir/lib.rs.html#439-445">source</a><h4 class="code-header">pub fn <a href="#method.sort_by_key" class="fn">sort_by_key</a><K, F>(self, cmp: F) -> Self<div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&<a class="struct" href="struct.DirEntry.html" title="struct walkdir::DirEntry">DirEntry</a>) -> K + <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,
|
||
K: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Set a function for sorting directory entries with a key extraction
|
||
function.</p>
|
||
<p>If a compare function is set, the resulting iterator will return all
|
||
paths in sorted order. The compare function will be called to compare
|
||
entries from the same directory.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::cmp;
|
||
<span class="kw">use </span>std::ffi::OsString;
|
||
<span class="kw">use </span>walkdir::WalkDir;
|
||
|
||
WalkDir::new(<span class="string">"foo"</span>).sort_by_key(|a| a.file_name().to_owned());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.sort_by_file_name" class="method"><a class="src rightside" href="../src/walkdir/lib.rs.html#456-458">source</a><h4 class="code-header">pub fn <a href="#method.sort_by_file_name" class="fn">sort_by_file_name</a>(self) -> Self</h4></section></summary><div class="docblock"><p>Sort directory entries by file name, to ensure a deterministic order.</p>
|
||
<p>This is a convenience function for calling <code>Self::sort_by()</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>walkdir::WalkDir;
|
||
|
||
WalkDir::new(<span class="string">"foo"</span>).sort_by_file_name();</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.contents_first" class="method"><a class="src rightside" href="../src/walkdir/lib.rs.html#517-520">source</a><h4 class="code-header">pub fn <a href="#method.contents_first" class="fn">contents_first</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -> Self</h4></section></summary><div class="docblock"><p>Yield a directory’s contents before the directory itself. By default,
|
||
this is disabled.</p>
|
||
<p>When <code>yes</code> is <code>false</code> (as is the default), the directory is yielded
|
||
before its contents are read. This is useful when, e.g. you want to
|
||
skip processing of some directories.</p>
|
||
<p>When <code>yes</code> is <code>true</code>, the iterator yields the contents of a directory
|
||
before yielding the directory itself. This is useful when, e.g. you
|
||
want to recursively delete a directory.</p>
|
||
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
|
||
<p>Assume the following directory tree:</p>
|
||
<div class="example-wrap"><pre class="language-text"><code>foo/
|
||
abc/
|
||
qrs
|
||
tuv
|
||
def/
|
||
</code></pre></div>
|
||
<p>With contents_first disabled (the default), the following code visits
|
||
the directory tree in depth-first order:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>walkdir::WalkDir;
|
||
|
||
<span class="kw">for </span>entry <span class="kw">in </span>WalkDir::new(<span class="string">"foo"</span>) {
|
||
<span class="kw">let </span>entry = entry.unwrap();
|
||
<span class="macro">println!</span>(<span class="string">"{}"</span>, entry.path().display());
|
||
}
|
||
|
||
<span class="comment">// foo
|
||
// foo/abc
|
||
// foo/abc/qrs
|
||
// foo/abc/tuv
|
||
// foo/def</span></code></pre></div>
|
||
<p>With contents_first enabled:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>walkdir::WalkDir;
|
||
|
||
<span class="kw">for </span>entry <span class="kw">in </span>WalkDir::new(<span class="string">"foo"</span>).contents_first(<span class="bool-val">true</span>) {
|
||
<span class="kw">let </span>entry = entry.unwrap();
|
||
<span class="macro">println!</span>(<span class="string">"{}"</span>, entry.path().display());
|
||
}
|
||
|
||
<span class="comment">// foo/abc/qrs
|
||
// foo/abc/tuv
|
||
// foo/abc
|
||
// foo/def
|
||
// foo</span></code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.same_file_system" class="method"><a class="src rightside" href="../src/walkdir/lib.rs.html#530-533">source</a><h4 class="code-header">pub fn <a href="#method.same_file_system" class="fn">same_file_system</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -> Self</h4></section></summary><div class="docblock"><p>Do not cross file system boundaries.</p>
|
||
<p>When this option is enabled, directory traversal will not descend into
|
||
directories that are on a different file system from the root path.</p>
|
||
<p>Currently, this option is only supported on Unix and Windows. If this
|
||
option is used on an unsupported platform, then directory traversal
|
||
will immediately return an error and will not yield any entries.</p>
|
||
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-WalkDir" class="impl"><a class="src rightside" href="../src/walkdir/lib.rs.html#233">source</a><a href="#impl-Debug-for-WalkDir" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.WalkDir.html" title="struct walkdir::WalkDir">WalkDir</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../src/walkdir/lib.rs.html#233">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.77.2/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.77.2/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.77.2/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoIterator-for-WalkDir" class="impl"><a class="src rightside" href="../src/walkdir/lib.rs.html#536-552">source</a><a href="#impl-IntoIterator-for-WalkDir" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for <a class="struct" href="struct.WalkDir.html" title="struct walkdir::WalkDir">WalkDir</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Item" class="associatedtype trait-impl"><a href="#associatedtype.Item" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.2/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.DirEntry.html" title="struct walkdir::DirEntry">DirEntry</a>, <a class="struct" href="struct.Error.html" title="struct walkdir::Error">Error</a>></h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle" open><summary><section id="associatedtype.IntoIter" class="associatedtype trait-impl"><a href="#associatedtype.IntoIter" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.2/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="associatedtype">IntoIter</a> = <a class="struct" href="struct.IntoIter.html" title="struct walkdir::IntoIter">IntoIter</a></h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter" class="method trait-impl"><a class="src rightside" href="../src/walkdir/lib.rs.html#540-551">source</a><a href="#method.into_iter" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -> <a class="struct" href="struct.IntoIter.html" title="struct walkdir::IntoIter">IntoIter</a> <a href="#" class="tooltip" data-notable-ty="IntoIter">ⓘ</a></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/1.77.2/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-WalkDir" class="impl"><a href="#impl-RefUnwindSafe-for-WalkDir" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.77.2/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.WalkDir.html" title="struct walkdir::WalkDir">WalkDir</a></h3></section><section id="impl-Send-for-WalkDir" class="impl"><a href="#impl-Send-for-WalkDir" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.WalkDir.html" title="struct walkdir::WalkDir">WalkDir</a></h3></section><section id="impl-Sync-for-WalkDir" class="impl"><a href="#impl-Sync-for-WalkDir" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.WalkDir.html" title="struct walkdir::WalkDir">WalkDir</a></h3></section><section id="impl-Unpin-for-WalkDir" class="impl"><a href="#impl-Unpin-for-WalkDir" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.WalkDir.html" title="struct walkdir::WalkDir">WalkDir</a></h3></section><section id="impl-UnwindSafe-for-WalkDir" class="impl"><a href="#impl-UnwindSafe-for-WalkDir" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.77.2/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.WalkDir.html" title="struct walkdir::WalkDir">WalkDir</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.77.2/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.77.2/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.77.2/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.77.2/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/borrow.rs.html#210">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.77.2/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.77.2/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.77.2/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/convert/mod.rs.html#764">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/convert/mod.rs.html#767">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/convert/mod.rs.html#747-749">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/convert/mod.rs.html#757">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
||
<p>That is, this conversion is whatever the implementation of
|
||
<code><a href="https://doc.rust-lang.org/1.77.2/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/convert/mod.rs.html#804-806">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/convert/mod.rs.html#811">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/convert/mod.rs.html#789-791">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.2/src/core/convert/mod.rs.html#796">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div><script type="text/json" id="notable-traits-data">{"IntoIter":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.IntoIter.html\" title=\"struct walkdir::IntoIter\">IntoIter</a></code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.IntoIter.html\" title=\"struct walkdir::IntoIter\">IntoIter</a></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"type\" href=\"type.Result.html\" title=\"type walkdir::Result\">Result</a><<a class=\"struct\" href=\"struct.DirEntry.html\" title=\"struct walkdir::DirEntry\">DirEntry</a>>;</div>"}</script></section></div></main></body></html> |