163 lines
No EOL
9.4 KiB
HTML
163 lines
No EOL
9.4 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta name="generator" content="rustdoc">
|
||
<meta name="description" content="API documentation for the Rust `DirEntry` struct in crate `bitflags`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, DirEntry">
|
||
|
||
<title>bitflags::__core::fs::DirEntry - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../../../rustdoc.css">
|
||
<link rel="stylesheet" type="text/css" href="../../../main.css">
|
||
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc">
|
||
<!--[if lte IE 8]>
|
||
<div class="warning">
|
||
This old browser is unsupported and will most likely display funky
|
||
things.
|
||
</div>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'><a href='../../index.html'>bitflags</a>::<wbr><a href='../index.html'>__core</a>::<wbr><a href='index.html'>fs</a></p><script>window.sidebarCurrent = {name: 'DirEntry', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||
</nav>
|
||
|
||
<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 struct">
|
||
<h1 class='fqn'><span class='in-band'>Struct <a href='../../index.html'>bitflags</a>::<wbr><a href='../index.html'>__core</a>::<wbr><a href='index.html'>fs</a>::<wbr><a class='struct' href=''>DirEntry</a></span><span class='out-of-band'><span id='render-detail'>
|
||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||
[<span class='inner'>−</span>]
|
||
</a>
|
||
</span><a id='src-3611' class='srclink' href='https://doc.rust-lang.org/nightly/std/fs/struct.DirEntry.html?gotosrc=3611' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust struct'>pub struct DirEntry(_);</pre><span class="since">1.0.0</span><div class='docblock'><p>Entries returned by the <code>ReadDir</code> iterator.</p>
|
||
|
||
<p>An instance of <code>DirEntry</code> represents an entry inside of a directory on the
|
||
filesystem. Each entry can be inspected via methods to learn about the full
|
||
path or possibly other metadata through per-platform extension traits.</p>
|
||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl <a class='struct' href='../../../bitflags/__core/fs/struct.DirEntry.html' title='bitflags::__core::fs::DirEntry'>DirEntry</a></code></h3><div class='impl-items'><h4 id='method.path' class='method'><code>fn <a href='#method.path' class='fnname'>path</a>(&self) -> <a class='struct' href='../../../bitflags/__core/path/struct.PathBuf.html' title='bitflags::__core::path::PathBuf'>PathBuf</a></code></h4>
|
||
<div class='docblock'><p>Returns the full path to the file that this entry represents.</p>
|
||
|
||
<p>The full path is created by joining the original path to <code>read_dir</code> or
|
||
<code>walk_dir</code> with the filename of this entry.</p>
|
||
|
||
<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>fs</span>;
|
||
<span class='kw'>for</span> <span class='ident'>entry</span> <span class='kw'>in</span> <span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>fs</span>::<span class='ident'>read_dir</span>(<span class='string'>"."</span>)) {
|
||
<span class='kw'>let</span> <span class='ident'>dir</span> <span class='op'>=</span> <span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>entry</span>);
|
||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"{:?}"</span>, <span class='ident'>dir</span>.<span class='ident'>path</span>());
|
||
}</pre>
|
||
|
||
<p>This prints output like:</p>
|
||
|
||
<pre><code class="language-text">"./whatever.txt"
|
||
"./foo.html"
|
||
"./hello_world.rs"
|
||
</code></pre>
|
||
|
||
<p>The exact text, of course, depends on what files you have in <code>.</code>.</p>
|
||
</div><h4 id='method.metadata' class='method'><code>fn <a href='#method.metadata' class='fnname'>metadata</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='struct' href='../../../bitflags/__core/fs/struct.Metadata.html' title='bitflags::__core::fs::Metadata'>Metadata</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.1.0</span></h4>
|
||
<div class='docblock'><p>Return the metadata for the file that this entry points at.</p>
|
||
|
||
<p>This function will not traverse symlinks if this entry points at a
|
||
symlink.</p>
|
||
|
||
<h1 id='platform-specific-behavior' class='section-header'><a href='#platform-specific-behavior'>Platform-specific behavior</a></h1>
|
||
<p>On Windows this function is cheap to call (no extra system calls
|
||
needed), but on Unix platforms this function is the equivalent of
|
||
calling <code>symlink_metadata</code> on the path.</p>
|
||
</div><h4 id='method.file_type' class='method'><code>fn <a href='#method.file_type' class='fnname'>file_type</a>(&self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='struct' href='../../../bitflags/__core/fs/struct.FileType.html' title='bitflags::__core::fs::FileType'>FileType</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code><span class="since">1.1.0</span></h4>
|
||
<div class='docblock'><p>Return the file type for the file that this entry points at.</p>
|
||
|
||
<p>This function will not traverse symlinks if this entry points at a
|
||
symlink.</p>
|
||
|
||
<h1 id='platform-specific-behavior-1' class='section-header'><a href='#platform-specific-behavior-1'>Platform-specific behavior</a></h1>
|
||
<p>On Windows and most Unix platforms this function is free (no extra
|
||
system calls needed), but some Unix platforms may require the equivalent
|
||
call to <code>symlink_metadata</code> to learn about the target file type.</p>
|
||
</div><h4 id='method.file_name' class='method'><code>fn <a href='#method.file_name' class='fnname'>file_name</a>(&self) -> <a class='struct' href='../../../bitflags/__core/ffi/struct.OsString.html' title='bitflags::__core::ffi::OsString'>OsString</a></code><span class="since">1.1.0</span></h4>
|
||
<div class='docblock'><p>Returns the bare file name of this directory entry without any other
|
||
leading path component.</p>
|
||
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><code>impl <a class='trait' href='../../../bitflags/__core/os/ext/prelude/trait.DirEntryExt.html' title='bitflags::__core::os::ext::prelude::DirEntryExt'>DirEntryExt</a> for <a class='struct' href='../../../bitflags/__core/fs/struct.DirEntry.html' title='bitflags::__core::fs::DirEntry'>DirEntry</a></code><span class="since">1.1.0</span></h3><div class='impl-items'><h4 id='method.ino' class='method'><code>fn <a href='../../../bitflags/__core/os/ext/prelude/trait.DirEntryExt.html#tymethod.ino' class='fnname'>ino</a>(&self) -> <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u64.html'>u64</a></code></h4>
|
||
</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>?</dt>
|
||
<dd>Show this help dialog</dd>
|
||
<dt>S</dt>
|
||
<dd>Focus the search field</dd>
|
||
<dt>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</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 = "bitflags";
|
||
window.playgroundUrl = "";
|
||
</script>
|
||
<script src="../../../jquery.js"></script>
|
||
<script src="../../../main.js"></script>
|
||
|
||
<script defer src="../../../search-index.js"></script>
|
||
</body>
|
||
</html> |