Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates > by-pkgid > 564935689ab5527f955e5449ded02799 > files > 4732

rust-doc-1.19.0-1.mga6.armv7hl.rpm

<!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 `PathBuf` struct in crate `std`.">
    <meta name="keywords" content="rust, rustlang, rust-lang, PathBuf">

    <title>std::path::PathBuf - Rust</title>

    <link rel="stylesheet" type="text/css" href="../../normalize.css">
    <link rel="stylesheet" type="text/css" href="../../rustdoc.css">
    <link rel="stylesheet" type="text/css" href="../../main.css">
    

    <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">
        <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 PathBuf</p><div class="block items"><ul><li><a href="#methods">Methods</a></li><li><a href="#deref-methods">Methods from Deref&lt;Target=Path&gt;</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='../index.html'>std</a>::<wbr><a href='index.html'>path</a></p><script>window.sidebarCurrent = {name: 'PathBuf', 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">
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>std</a>::<wbr><a href='index.html'>path</a>::<wbr><a class="struct" href=''>PathBuf</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'>&#x2212;</span>]
                   </a>
               </span><a class='srclink' href='../../src/std/path.rs.html#1083-1085' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct PathBuf { /* fields omitted */ }</pre><div class='docblock'><p>An owned, mutable path (akin to <a href="../string/struct.String.html"><code>String</code></a>).</p>

<p>This type provides methods like <a href="struct.PathBuf.html#method.push"><code>push</code></a> and <a href="struct.PathBuf.html#method.set_extension"><code>set_extension</code></a> that mutate
the path in place. It also implements <a href="../ops/trait.Deref.html"><code>Deref</code></a> to <a href="struct.Path.html"><code>Path</code></a>, meaning that
all methods on <a href="struct.Path.html"><code>Path</code></a> slices are available on <code>PathBuf</code> values as well.</p>

<p>More details about the overall approach can be found in
the module documentation.</p>

<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
<p>You can use <a href="struct.PathBuf.html#method.push"><code>push</code></a> to build up a <code>PathBuf</code> from
components:</p>

<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">PathBuf</span>;

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">PathBuf</span>::<span class="ident">new</span>();

<span class="ident">path</span>.<span class="ident">push</span>(<span class="string">r&quot;C:\&quot;</span>);
<span class="ident">path</span>.<span class="ident">push</span>(<span class="string">&quot;windows&quot;</span>);
<span class="ident">path</span>.<span class="ident">push</span>(<span class="string">&quot;system32&quot;</span>);

<span class="ident">path</span>.<span class="ident">set_extension</span>(<span class="string">&quot;dll&quot;</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APathBuf%3B%0A%0Alet%20mut%20path%20%3D%20PathBuf%3A%3Anew()%3B%0A%0Apath.push(r%22C%3A%5C%22)%3B%0Apath.push(%22windows%22)%3B%0Apath.push(%22system32%22)%3B%0A%0Apath.set_extension(%22dll%22)%3B%0A%7D">Run</a></pre>

<p>However, <a href="struct.PathBuf.html#method.push"><code>push</code></a> is best used for dynamic situations. This is a better way
to do this when you know all of the components ahead of time:</p>

<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">PathBuf</span>;

<span class="kw">let</span> <span class="ident">path</span>: <span class="ident">PathBuf</span> <span class="op">=</span> [<span class="string">r&quot;C:\&quot;</span>, <span class="string">&quot;windows&quot;</span>, <span class="string">&quot;system32.dll&quot;</span>].<span class="ident">iter</span>().<span class="ident">collect</span>();<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APathBuf%3B%0A%0Alet%20path%3A%20PathBuf%20%3D%20%5Br%22C%3A%5C%22%2C%20%22windows%22%2C%20%22system32.dll%22%5D.iter().collect()%3B%0A%7D">Run</a></pre>

<p>We can still do better than this! Since these are all strings, we can use
<code>From::from</code>:</p>

<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">PathBuf</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">r&quot;C:\windows\system32.dll&quot;</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APathBuf%3B%0A%0Alet%20path%20%3D%20PathBuf%3A%3Afrom(r%22C%3A%5Cwindows%5Csystem32.dll%22)%3B%0A%7D">Run</a></pre>

<p>Which method works best depends on what kind of situation you&#39;re in.</p>
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1087-1334' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>fn <a href='#method.new' class='fnname'>new</a>() -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='docblock'><p>Allocates an empty <code>PathBuf</code>.</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">path</span>::<span class="ident">PathBuf</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">PathBuf</span>::<span class="ident">new</span>();<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APathBuf%3B%0A%0Alet%20path%20%3D%20PathBuf%3A%3Anew()%3B%0A%7D">Run</a></pre>
</div><h4 id='method.as_path' class="method"><span id='as_path.v' class='invisible'><code>fn <a href='#method.as_path' class='fnname'>as_path</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a></code></span></h4>
<div class='docblock'><p>Coerces to a <a href="struct.Path.html"><code>Path</code></a> slice.</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">path</span>::{<span class="ident">Path</span>, <span class="ident">PathBuf</span>};

<span class="kw">let</span> <span class="ident">p</span> <span class="op">=</span> <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/test&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/test&quot;</span>), <span class="ident">p</span>.<span class="ident">as_path</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3A%7BPath%2C%20PathBuf%7D%3B%0A%0Alet%20p%20%3D%20PathBuf%3A%3Afrom(%22%2Ftest%22)%3B%0Aassert_eq!(Path%3A%3Anew(%22%2Ftest%22)%2C%20p.as_path())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.push' class="method"><span id='push.v' class='invisible'><code>fn <a href='#method.push' class='fnname'>push</a>&lt;P:&nbsp;<a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt;(&amp;mut self, path: P)</code></span></h4>
<div class='docblock'><p>Extends <code>self</code> with <code>path</code>.</p>

<p>If <code>path</code> is absolute, it replaces the current path.</p>

<p>On Windows:</p>

<ul>
<li>if <code>path</code> has a root but no prefix (e.g. <code>\windows</code>), it
replaces everything except for the prefix (if any) of <code>self</code>.</li>
<li>if <code>path</code> has a prefix but no root, it replaces <code>self</code>.</li>
</ul>

<h1 id='examples-3' class='section-header'><a href='#examples-3'>Examples</a></h1>
<p>Pushing a relative path extends the existing path:</p>

<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">PathBuf</span>;

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/tmp&quot;</span>);
<span class="ident">path</span>.<span class="ident">push</span>(<span class="string">&quot;file.bk&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path</span>, <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/tmp/file.bk&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APathBuf%3B%0A%0Alet%20mut%20path%20%3D%20PathBuf%3A%3Afrom(%22%2Ftmp%22)%3B%0Apath.push(%22file.bk%22)%3B%0Aassert_eq!(path%2C%20PathBuf%3A%3Afrom(%22%2Ftmp%2Ffile.bk%22))%3B%0A%7D">Run</a></pre>

<p>Pushing an absolute path replaces the existing path:</p>

<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">PathBuf</span>;

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/tmp&quot;</span>);
<span class="ident">path</span>.<span class="ident">push</span>(<span class="string">&quot;/etc&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path</span>, <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/etc&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APathBuf%3B%0A%0Alet%20mut%20path%20%3D%20PathBuf%3A%3Afrom(%22%2Ftmp%22)%3B%0Apath.push(%22%2Fetc%22)%3B%0Aassert_eq!(path%2C%20PathBuf%3A%3Afrom(%22%2Fetc%22))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.pop' class="method"><span id='pop.v' class='invisible'><code>fn <a href='#method.pop' class='fnname'>pop</a>(&amp;mut self) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>Truncate <code>self</code> to <a href="struct.PathBuf.html#method.parent"><code>self.parent</code></a>.</p>

<p>Returns <code>false</code> and does nothing if <a href="struct.PathBuf.html#method.file_name"><code>self.file_name</code></a> is <a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a>.
Otherwise, returns <code>true</code>.</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">path</span>::{<span class="ident">Path</span>, <span class="ident">PathBuf</span>};

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">p</span> <span class="op">=</span> <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/test/test.rs&quot;</span>);

<span class="ident">p</span>.<span class="ident">pop</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/test&quot;</span>), <span class="ident">p</span>);
<span class="ident">p</span>.<span class="ident">pop</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/&quot;</span>), <span class="ident">p</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3A%7BPath%2C%20PathBuf%7D%3B%0A%0Alet%20mut%20p%20%3D%20PathBuf%3A%3Afrom(%22%2Ftest%2Ftest.rs%22)%3B%0A%0Ap.pop()%3B%0Aassert_eq!(Path%3A%3Anew(%22%2Ftest%22)%2C%20p)%3B%0Ap.pop()%3B%0Aassert_eq!(Path%3A%3Anew(%22%2F%22)%2C%20p)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.set_file_name' class="method"><span id='set_file_name.v' class='invisible'><code>fn <a href='#method.set_file_name' class='fnname'>set_file_name</a>&lt;S:&nbsp;<a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;&gt;(&amp;mut self, file_name: S)</code></span></h4>
<div class='docblock'><p>Updates <a href="struct.PathBuf.html#method.file_name"><code>self.file_name</code></a> to <code>file_name</code>.</p>

<p>If <a href="struct.PathBuf.html#method.file_name"><code>self.file_name</code></a> was <a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a>, this is equivalent to pushing
<code>file_name</code>.</p>

<p>Otherwise it is equivalent to calling <a href="struct.PathBuf.html#method.pop"><code>pop</code></a> and then pushing
<code>file_name</code>. The new path will be a sibling of the original path.
(That is, it will have the same parent.)</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">path</span>::<span class="ident">PathBuf</span>;

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/&quot;</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">buf</span>.<span class="ident">file_name</span>() <span class="op">==</span> <span class="prelude-val">None</span>);
<span class="ident">buf</span>.<span class="ident">set_file_name</span>(<span class="string">&quot;bar&quot;</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">buf</span> <span class="op">==</span> <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/bar&quot;</span>));
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">buf</span>.<span class="ident">file_name</span>().<span class="ident">is_some</span>());
<span class="ident">buf</span>.<span class="ident">set_file_name</span>(<span class="string">&quot;baz.txt&quot;</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">buf</span> <span class="op">==</span> <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/baz.txt&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APathBuf%3B%0A%0Alet%20mut%20buf%20%3D%20PathBuf%3A%3Afrom(%22%2F%22)%3B%0Aassert!(buf.file_name()%20%3D%3D%20None)%3B%0Abuf.set_file_name(%22bar%22)%3B%0Aassert!(buf%20%3D%3D%20PathBuf%3A%3Afrom(%22%2Fbar%22))%3B%0Aassert!(buf.file_name().is_some())%3B%0Abuf.set_file_name(%22baz.txt%22)%3B%0Aassert!(buf%20%3D%3D%20PathBuf%3A%3Afrom(%22%2Fbaz.txt%22))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.set_extension' class="method"><span id='set_extension.v' class='invisible'><code>fn <a href='#method.set_extension' class='fnname'>set_extension</a>&lt;S:&nbsp;<a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;&gt;(&amp;mut self, extension: S) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>Updates <a href="struct.PathBuf.html#method.extension"><code>self.extension</code></a> to <code>extension</code>.</p>

<p>Returns <code>false</code> and does nothing if <a href="struct.PathBuf.html#method.file_name"><code>self.file_name</code></a> is <a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a>,
returns <code>true</code> and updates the extension otherwise.</p>

<p>If <a href="struct.PathBuf.html#method.extension"><code>self.extension</code></a> is <a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a>, the extension is added; otherwise
it is replaced.</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">path</span>::{<span class="ident">Path</span>, <span class="ident">PathBuf</span>};

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">p</span> <span class="op">=</span> <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/feel/the&quot;</span>);

<span class="ident">p</span>.<span class="ident">set_extension</span>(<span class="string">&quot;force&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/feel/the.force&quot;</span>), <span class="ident">p</span>.<span class="ident">as_path</span>());

<span class="ident">p</span>.<span class="ident">set_extension</span>(<span class="string">&quot;dark_side&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/feel/the.dark_side&quot;</span>), <span class="ident">p</span>.<span class="ident">as_path</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3A%7BPath%2C%20PathBuf%7D%3B%0A%0Alet%20mut%20p%20%3D%20PathBuf%3A%3Afrom(%22%2Ffeel%2Fthe%22)%3B%0A%0Ap.set_extension(%22force%22)%3B%0Aassert_eq!(Path%3A%3Anew(%22%2Ffeel%2Fthe.force%22)%2C%20p.as_path())%3B%0A%0Ap.set_extension(%22dark_side%22)%3B%0Aassert_eq!(Path%3A%3Anew(%22%2Ffeel%2Fthe.dark_side%22)%2C%20p.as_path())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.into_os_string' class="method"><span id='into_os_string.v' class='invisible'><code>fn <a href='#method.into_os_string' class='fnname'>into_os_string</a>(self) -&gt; <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a></code></span></h4>
<div class='docblock'><p>Consumes the <code>PathBuf</code>, yielding its internal <a href="../ffi/struct.OsString.html"><code>OsString</code></a> storage.</p>

<h1 id='examples-7' class='section-header'><a href='#examples-7'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">PathBuf</span>;

<span class="kw">let</span> <span class="ident">p</span> <span class="op">=</span> <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/the/head&quot;</span>);
<span class="kw">let</span> <span class="ident">os_str</span> <span class="op">=</span> <span class="ident">p</span>.<span class="ident">into_os_string</span>();<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APathBuf%3B%0A%0Alet%20p%20%3D%20PathBuf%3A%3Afrom(%22%2Fthe%2Fhead%22)%3B%0Alet%20os_str%20%3D%20p.into_os_string()%3B%0A%7D">Run</a></pre>
</div><h4 id='method.into_boxed_path' class="method"><span id='into_boxed_path.v' class='invisible'><code>fn <a href='#method.into_boxed_path' class='fnname'>into_boxed_path</a>(self) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code></span></h4>
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API.  (<code>into_boxed_path </code><a href="https://github.com/rust-lang/rust/issues/40380">#40380</a>)</div></div><div class='docblock'><p>Converts this <code>PathBuf</code> into a <a href="../../std/boxed/struct.Box.html">boxed</a> <a href="struct.Path.html"><code>Path</code></a>.</p>
</div></div><h2 id='deref-methods'>Methods from <a class="trait" href="../../std/ops/trait.Deref.html" title="trait std::ops::Deref">Deref</a>&lt;Target = <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</h2><div class='impl-items'><h4 id='method.as_os_str' class="method"><span id='as_os_str.v' class='invisible'><code>fn <a href='#method.as_os_str' class='fnname'>as_os_str</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a></code></span></h4>
<div class='docblock'><p>Yields the underlying <a href="../ffi/struct.OsStr.html"><code>OsStr</code></a> slice.</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">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">os_str</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>).<span class="ident">as_os_str</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">os_str</span>, <span class="ident">std</span>::<span class="ident">ffi</span>::<span class="ident">OsStr</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20os_str%20%3D%20Path%3A%3Anew(%22foo.txt%22).as_os_str()%3B%0Aassert_eq!(os_str%2C%20std%3A%3Affi%3A%3AOsStr%3A%3Anew(%22foo.txt%22))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.to_str' class="method"><span id='to_str.v' class='invisible'><code>fn <a href='#method.to_str' class='fnname'>to_str</a>(&amp;self) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;&amp;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code></span></h4>
<div class='docblock'><p>Yields a <a href="../primitive.str.html"><code>&amp;str</code></a> slice if the <code>Path</code> is valid unicode.</p>

<p>This conversion may entail doing a check for UTF-8 validity.</p>

<h1 id='examples-9' class='section-header'><a href='#examples-9'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path</span>.<span class="ident">to_str</span>(), <span class="prelude-val">Some</span>(<span class="string">&quot;foo.txt&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22foo.txt%22)%3B%0Aassert_eq!(path.to_str()%2C%20Some(%22foo.txt%22))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.to_string_lossy' class="method"><span id='to_string_lossy.v' class='invisible'><code>fn <a href='#method.to_string_lossy' class='fnname'>to_string_lossy</a>(&amp;self) -&gt; <a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;<a class="primitive" href="../primitive.str.html">str</a>&gt;</code></span></h4>
<div class='docblock'><p>Converts a <code>Path</code> to a <a href="../borrow/enum.Cow.html"><code>Cow&lt;str&gt;</code></a>.</p>

<p>Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.</p>

<h1 id='examples-10' class='section-header'><a href='#examples-10'>Examples</a></h1>
<p>Calling <code>to_string_lossy</code> on a <code>Path</code> with valid unicode:</p>

<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path</span>.<span class="ident">to_string_lossy</span>(), <span class="string">&quot;foo.txt&quot;</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22foo.txt%22)%3B%0Aassert_eq!(path.to_string_lossy()%2C%20%22foo.txt%22)%3B%0A%7D">Run</a></pre>

<p>Had <code>path</code> contained invalid unicode, the <code>to_string_lossy</code> call might
have returned <code>&quot;fo�.txt&quot;</code>.</p>
</div><h4 id='method.to_path_buf' class="method"><span id='to_path_buf.v' class='invisible'><code>fn <a href='#method.to_path_buf' class='fnname'>to_path_buf</a>(&amp;self) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='docblock'><p>Converts a <code>Path</code> to an owned <a href="struct.PathBuf.html"><code>PathBuf</code></a>.</p>

<h1 id='examples-11' class='section-header'><a href='#examples-11'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path_buf</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>).<span class="ident">to_path_buf</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path_buf</span>, <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;foo.txt&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path_buf%20%3D%20Path%3A%3Anew(%22foo.txt%22).to_path_buf()%3B%0Aassert_eq!(path_buf%2C%20std%3A%3Apath%3A%3APathBuf%3A%3Afrom(%22foo.txt%22))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.is_absolute' class="method"><span id='is_absolute.v' class='invisible'><code>fn <a href='#method.is_absolute' class='fnname'>is_absolute</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>Returns <code>true</code> if the <code>Path</code> is absolute, i.e. if it is independent of
the current directory.</p>

<ul>
<li><p>On Unix, a path is absolute if it starts with the root, so
<code>is_absolute</code> and <a href="#method.has_root"><code>has_root</code></a> are equivalent.</p></li>
<li><p>On Windows, a path is absolute if it has a prefix and starts with the
root: <code>c:\windows</code> is absolute, while <code>c:temp</code> and <code>\temp</code> are not.</p></li>
</ul>

<h1 id='examples-12' class='section-header'><a href='#examples-12'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>).<span class="ident">is_absolute</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Aassert!(!Path%3A%3Anew(%22foo.txt%22).is_absolute())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.is_relative' class="method"><span id='is_relative.v' class='invisible'><code>fn <a href='#method.is_relative' class='fnname'>is_relative</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>Return <code>false</code> if the <code>Path</code> is relative, i.e. not absolute.</p>

<p>See <a href="#method.is_absolute"><code>is_absolute</code></a>&#39;s documentation for more details.</p>

<h1 id='examples-13' class='section-header'><a href='#examples-13'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>).<span class="ident">is_relative</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Aassert!(Path%3A%3Anew(%22foo.txt%22).is_relative())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.has_root' class="method"><span id='has_root.v' class='invisible'><code>fn <a href='#method.has_root' class='fnname'>has_root</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>Returns <code>true</code> if the <code>Path</code> has a root.</p>

<ul>
<li><p>On Unix, a path has a root if it begins with <code>/</code>.</p></li>
<li><p>On Windows, a path has a root if it:</p>

<ul>
<li>has no prefix and begins with a separator, e.g. <code>\\windows</code></li>
<li>has a prefix followed by a separator, e.g. <code>c:\windows</code> but not <code>c:windows</code></li>
<li>has any non-disk prefix, e.g. <code>\\server\share</code></li>
</ul></li>
</ul>

<h1 id='examples-14' class='section-header'><a href='#examples-14'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/etc/passwd&quot;</span>).<span class="ident">has_root</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Aassert!(Path%3A%3Anew(%22%2Fetc%2Fpasswd%22).has_root())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.parent' class="method"><span id='parent.v' class='invisible'><code>fn <a href='#method.parent' class='fnname'>parent</a>(&amp;self) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;&amp;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code></span></h4>
<div class='docblock'><p>Returns the <code>Path</code> without its final component, if there is one.</p>

<p>Returns <a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a> if the path terminates in a root or prefix.</p>

<h1 id='examples-15' class='section-header'><a href='#examples-15'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/foo/bar&quot;</span>);
<span class="kw">let</span> <span class="ident">parent</span> <span class="op">=</span> <span class="ident">path</span>.<span class="ident">parent</span>().<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">parent</span>, <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/foo&quot;</span>));

<span class="kw">let</span> <span class="ident">grand_parent</span> <span class="op">=</span> <span class="ident">parent</span>.<span class="ident">parent</span>().<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">grand_parent</span>, <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/&quot;</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">grand_parent</span>.<span class="ident">parent</span>(), <span class="prelude-val">None</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2Ffoo%2Fbar%22)%3B%0Alet%20parent%20%3D%20path.parent().unwrap()%3B%0Aassert_eq!(parent%2C%20Path%3A%3Anew(%22%2Ffoo%22))%3B%0A%0Alet%20grand_parent%20%3D%20parent.parent().unwrap()%3B%0Aassert_eq!(grand_parent%2C%20Path%3A%3Anew(%22%2F%22))%3B%0Aassert_eq!(grand_parent.parent()%2C%20None)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.file_name' class="method"><span id='file_name.v' class='invisible'><code>fn <a href='#method.file_name' class='fnname'>file_name</a>(&amp;self) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;&amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code></span></h4>
<div class='docblock'><p>Returns the final component of the <code>Path</code>, if there is one.</p>

<p>If the path is a normal file, this is the file name. If it&#39;s the path of a directory, this
is the directory name.</p>

<p>Returns <a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a> If the path terminates in <code>..</code>.</p>

<h1 id='examples-16' class='section-header'><a href='#examples-16'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">ffi</span>::<span class="ident">OsStr</span>;

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">Some</span>(<span class="ident">OsStr</span>::<span class="ident">new</span>(<span class="string">&quot;bin&quot;</span>)), <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/usr/bin/&quot;</span>).<span class="ident">file_name</span>());
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">Some</span>(<span class="ident">OsStr</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>)), <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;tmp/foo.txt&quot;</span>).<span class="ident">file_name</span>());
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">Some</span>(<span class="ident">OsStr</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>)), <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt/.&quot;</span>).<span class="ident">file_name</span>());
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">Some</span>(<span class="ident">OsStr</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>)), <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt/.//&quot;</span>).<span class="ident">file_name</span>());
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">None</span>, <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt/..&quot;</span>).<span class="ident">file_name</span>());
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">None</span>, <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/&quot;</span>).<span class="ident">file_name</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0Ause%20std%3A%3Affi%3A%3AOsStr%3B%0A%0Aassert_eq!(Some(OsStr%3A%3Anew(%22bin%22))%2C%20Path%3A%3Anew(%22%2Fusr%2Fbin%2F%22).file_name())%3B%0Aassert_eq!(Some(OsStr%3A%3Anew(%22foo.txt%22))%2C%20Path%3A%3Anew(%22tmp%2Ffoo.txt%22).file_name())%3B%0Aassert_eq!(Some(OsStr%3A%3Anew(%22foo.txt%22))%2C%20Path%3A%3Anew(%22foo.txt%2F.%22).file_name())%3B%0Aassert_eq!(Some(OsStr%3A%3Anew(%22foo.txt%22))%2C%20Path%3A%3Anew(%22foo.txt%2F.%2F%2F%22).file_name())%3B%0Aassert_eq!(None%2C%20Path%3A%3Anew(%22foo.txt%2F..%22).file_name())%3B%0Aassert_eq!(None%2C%20Path%3A%3Anew(%22%2F%22).file_name())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.strip_prefix' class="method"><span id='strip_prefix.v' class='invisible'><code>fn <a href='#method.strip_prefix' class='fnname'>strip_prefix</a>&lt;'a, P:&nbsp;?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a>&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;'a self, <br>&nbsp;&nbsp;&nbsp;&nbsp;base: &amp;'a P<br>) -&gt; <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a>&lt;&amp;'a <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>, <a class="struct" href="../../std/path/struct.StripPrefixError.html" title="struct std::path::StripPrefixError">StripPrefixError</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;,&nbsp;</span></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4>
<div class='docblock'><p>Returns a path that, when joined onto <code>base</code>, yields <code>self</code>.</p>

<h1 id='errors' class='section-header'><a href='#errors'>Errors</a></h1>
<p>If <code>base</code> is not a prefix of <code>self</code> (i.e. <a href="#method.starts_with"><code>starts_with</code></a>
returns <code>false</code>), returns <a href="../../std/result/enum.Result.html#variant.Err"><code>Err</code></a>.</p>

<h1 id='examples-17' class='section-header'><a href='#examples-17'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/test/haha/foo.txt&quot;</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path</span>.<span class="ident">strip_prefix</span>(<span class="string">&quot;/test&quot;</span>), <span class="prelude-val">Ok</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;haha/foo.txt&quot;</span>)));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path</span>.<span class="ident">strip_prefix</span>(<span class="string">&quot;test&quot;</span>).<span class="ident">is_ok</span>(), <span class="bool-val">false</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path</span>.<span class="ident">strip_prefix</span>(<span class="string">&quot;/haha&quot;</span>).<span class="ident">is_ok</span>(), <span class="bool-val">false</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2Ftest%2Fhaha%2Ffoo.txt%22)%3B%0A%0Aassert_eq!(path.strip_prefix(%22%2Ftest%22)%2C%20Ok(Path%3A%3Anew(%22haha%2Ffoo.txt%22)))%3B%0Aassert_eq!(path.strip_prefix(%22test%22).is_ok()%2C%20false)%3B%0Aassert_eq!(path.strip_prefix(%22%2Fhaha%22).is_ok()%2C%20false)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.starts_with' class="method"><span id='starts_with.v' class='invisible'><code>fn <a href='#method.starts_with' class='fnname'>starts_with</a>&lt;P:&nbsp;<a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt;(&amp;self, base: P) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>Determines whether <code>base</code> is a prefix of <code>self</code>.</p>

<p>Only considers whole path components to match.</p>

<h1 id='examples-18' class='section-header'><a href='#examples-18'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/etc/passwd&quot;</span>);

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">path</span>.<span class="ident">starts_with</span>(<span class="string">&quot;/etc&quot;</span>));

<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">path</span>.<span class="ident">starts_with</span>(<span class="string">&quot;/e&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2Fetc%2Fpasswd%22)%3B%0A%0Aassert!(path.starts_with(%22%2Fetc%22))%3B%0A%0Aassert!(!path.starts_with(%22%2Fe%22))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.ends_with' class="method"><span id='ends_with.v' class='invisible'><code>fn <a href='#method.ends_with' class='fnname'>ends_with</a>&lt;P:&nbsp;<a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt;(&amp;self, child: P) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>Determines whether <code>child</code> is a suffix of <code>self</code>.</p>

<p>Only considers whole path components to match.</p>

<h1 id='examples-19' class='section-header'><a href='#examples-19'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/etc/passwd&quot;</span>);

<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">path</span>.<span class="ident">ends_with</span>(<span class="string">&quot;passwd&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2Fetc%2Fpasswd%22)%3B%0A%0Aassert!(path.ends_with(%22passwd%22))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.file_stem' class="method"><span id='file_stem.v' class='invisible'><code>fn <a href='#method.file_stem' class='fnname'>file_stem</a>(&amp;self) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;&amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code></span></h4>
<div class='docblock'><p>Extracts the stem (non-extension) portion of <a href="struct.Path.html#method.file_name"><code>self.file_name</code></a>.</p>

<p>The stem is:</p>

<ul>
<li><a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a>, if there is no file name;</li>
<li>The entire file name if there is no embedded <code>.</code>;</li>
<li>The entire file name if the file name begins with <code>.</code> and has no other <code>.</code>s within;</li>
<li>Otherwise, the portion of the file name before the final <code>.</code></li>
</ul>

<h1 id='examples-20' class='section-header'><a href='#examples-20'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.rs&quot;</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">&quot;foo&quot;</span>, <span class="ident">path</span>.<span class="ident">file_stem</span>().<span class="ident">unwrap</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22foo.rs%22)%3B%0A%0Aassert_eq!(%22foo%22%2C%20path.file_stem().unwrap())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.extension' class="method"><span id='extension.v' class='invisible'><code>fn <a href='#method.extension' class='fnname'>extension</a>(&amp;self) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;&amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;</code></span></h4>
<div class='docblock'><p>Extracts the extension of <a href="struct.Path.html#method.file_name"><code>self.file_name</code></a>, if possible.</p>

<p>The extension is:</p>

<ul>
<li><a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a>, if there is no file name;</li>
<li><a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a>, if there is no embedded <code>.</code>;</li>
<li><a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a>, if the file name begins with <code>.</code> and has no other <code>.</code>s within;</li>
<li>Otherwise, the portion of the file name after the final <code>.</code></li>
</ul>

<h1 id='examples-21' class='section-header'><a href='#examples-21'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.rs&quot;</span>);

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">&quot;rs&quot;</span>, <span class="ident">path</span>.<span class="ident">extension</span>().<span class="ident">unwrap</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22foo.rs%22)%3B%0A%0Aassert_eq!(%22rs%22%2C%20path.extension().unwrap())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.join' class="method"><span id='join.v' class='invisible'><code>fn <a href='#method.join' class='fnname'>join</a>&lt;P:&nbsp;<a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt;(&amp;self, path: P) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='docblock'><p>Creates an owned <a href="struct.PathBuf.html"><code>PathBuf</code></a> with <code>path</code> adjoined to <code>self</code>.</p>

<p>See <a href="struct.PathBuf.html#method.push"><code>PathBuf::push</code></a> for more details on what it means to adjoin a path.</p>

<h1 id='examples-22' class='section-header'><a href='#examples-22'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::{<span class="ident">Path</span>, <span class="ident">PathBuf</span>};

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/etc&quot;</span>).<span class="ident">join</span>(<span class="string">&quot;passwd&quot;</span>), <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/etc/passwd&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3A%7BPath%2C%20PathBuf%7D%3B%0A%0Aassert_eq!(Path%3A%3Anew(%22%2Fetc%22).join(%22passwd%22)%2C%20PathBuf%3A%3Afrom(%22%2Fetc%2Fpasswd%22))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.with_file_name' class="method"><span id='with_file_name.v' class='invisible'><code>fn <a href='#method.with_file_name' class='fnname'>with_file_name</a>&lt;S:&nbsp;<a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;&gt;(&amp;self, file_name: S) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='docblock'><p>Creates an owned <a href="struct.PathBuf.html"><code>PathBuf</code></a> like <code>self</code> but with the given file name.</p>

<p>See <a href="struct.PathBuf.html#method.set_file_name"><code>PathBuf::set_file_name</code></a> for more details.</p>

<h1 id='examples-23' class='section-header'><a href='#examples-23'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::{<span class="ident">Path</span>, <span class="ident">PathBuf</span>};

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/tmp/foo.txt&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path</span>.<span class="ident">with_file_name</span>(<span class="string">&quot;bar.txt&quot;</span>), <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/tmp/bar.txt&quot;</span>));

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/tmp&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path</span>.<span class="ident">with_file_name</span>(<span class="string">&quot;var&quot;</span>), <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/var&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3A%7BPath%2C%20PathBuf%7D%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2Ftmp%2Ffoo.txt%22)%3B%0Aassert_eq!(path.with_file_name(%22bar.txt%22)%2C%20PathBuf%3A%3Afrom(%22%2Ftmp%2Fbar.txt%22))%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2Ftmp%22)%3B%0Aassert_eq!(path.with_file_name(%22var%22)%2C%20PathBuf%3A%3Afrom(%22%2Fvar%22))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.with_extension' class="method"><span id='with_extension.v' class='invisible'><code>fn <a href='#method.with_extension' class='fnname'>with_extension</a>&lt;S:&nbsp;<a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;&gt;(&amp;self, extension: S) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='docblock'><p>Creates an owned <a href="struct.PathBuf.html"><code>PathBuf</code></a> like <code>self</code> but with the given extension.</p>

<p>See <a href="struct.PathBuf.html#method.set_extension"><code>PathBuf::set_extension</code></a> for more details.</p>

<h1 id='examples-24' class='section-header'><a href='#examples-24'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::{<span class="ident">Path</span>, <span class="ident">PathBuf</span>};

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;foo.rs&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path</span>.<span class="ident">with_extension</span>(<span class="string">&quot;txt&quot;</span>), <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;foo.txt&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3A%7BPath%2C%20PathBuf%7D%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22foo.rs%22)%3B%0Aassert_eq!(path.with_extension(%22txt%22)%2C%20PathBuf%3A%3Afrom(%22foo.txt%22))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.components' class="method"><span id='components.v' class='invisible'><code>fn <a href='#method.components' class='fnname'>components</a>(&amp;self) -&gt; <a class="struct" href="../../std/path/struct.Components.html" title="struct std::path::Components">Components</a></code></span></h4>
<div class='docblock'><p>Produces an iterator over the <a href="enum.Component.html"><code>Component</code></a>s of the path.</p>

<p>When parsing the path, there is a small amount of normalization:</p>

<ul>
<li><p>Repeated separators are ignored, so <code>a/b</code> and <code>a//b</code> both have
<code>a</code> and <code>b</code> as components.</p></li>
<li><p>Occurentces of <code>.</code> are normalized away, exept if they are at the
beginning of the path. For example, <code>a/./b</code>, <code>a/b/</code>, <code>a/b/.</code> and
<code>a/b</code> all have <code>a</code> and <code>b</code> as components, but <code>./a/b</code> starts with
an additional <a href="enum.Component.html#variant.CurDir"><code>CurDir</code></a> component.</p></li>
</ul>

<p>Note that no other normalization takes place; in particular, <code>a/c</code>
and <code>a/b/../c</code> are distinct, to account for the possibility that <code>b</code>
is a symbolic link (so its parent isn&#39;t <code>a</code>).</p>

<h1 id='examples-25' class='section-header'><a href='#examples-25'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::{<span class="ident">Path</span>, <span class="ident">Component</span>};
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">ffi</span>::<span class="ident">OsStr</span>;

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">components</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/tmp/foo.txt&quot;</span>).<span class="ident">components</span>();

<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">components</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Component</span>::<span class="ident">RootDir</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">components</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Component</span>::<span class="ident">Normal</span>(<span class="ident">OsStr</span>::<span class="ident">new</span>(<span class="string">&quot;tmp&quot;</span>))));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">components</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Component</span>::<span class="ident">Normal</span>(<span class="ident">OsStr</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>))));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">components</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>)<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3A%7BPath%2C%20Component%7D%3B%0Ause%20std%3A%3Affi%3A%3AOsStr%3B%0A%0Alet%20mut%20components%20%3D%20Path%3A%3Anew(%22%2Ftmp%2Ffoo.txt%22).components()%3B%0A%0Aassert_eq!(components.next()%2C%20Some(Component%3A%3ARootDir))%3B%0Aassert_eq!(components.next()%2C%20Some(Component%3A%3ANormal(OsStr%3A%3Anew(%22tmp%22))))%3B%0Aassert_eq!(components.next()%2C%20Some(Component%3A%3ANormal(OsStr%3A%3Anew(%22foo.txt%22))))%3B%0Aassert_eq!(components.next()%2C%20None)%0A%7D">Run</a></pre>
</div><h4 id='method.iter' class="method"><span id='iter.v' class='invisible'><code>fn <a href='#method.iter' class='fnname'>iter</a>(&amp;self) -&gt; <a class="struct" href="../../std/path/struct.Iter.html" title="struct std::path::Iter">Iter</a></code></span></h4>
<div class='docblock'><p>Produces an iterator over the path&#39;s components viewed as <a href="../ffi/struct.OsStr.html"><code>OsStr</code></a>
slices.</p>

<p>For more information about the particulars of how the path is separated
into components, see <a href="#method.components"><code>components</code></a>.</p>

<h1 id='examples-26' class='section-header'><a href='#examples-26'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::{<span class="self">self</span>, <span class="ident">Path</span>};
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">ffi</span>::<span class="ident">OsStr</span>;

<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">it</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/tmp/foo.txt&quot;</span>).<span class="ident">iter</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">it</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">OsStr</span>::<span class="ident">new</span>(<span class="kw-2">&amp;</span><span class="ident">path</span>::<span class="ident">MAIN_SEPARATOR</span>.<span class="ident">to_string</span>())));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">it</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">OsStr</span>::<span class="ident">new</span>(<span class="string">&quot;tmp&quot;</span>)));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">it</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">OsStr</span>::<span class="ident">new</span>(<span class="string">&quot;foo.txt&quot;</span>)));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">it</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>)<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3A%7Bself%2C%20Path%7D%3B%0Ause%20std%3A%3Affi%3A%3AOsStr%3B%0A%0Alet%20mut%20it%20%3D%20Path%3A%3Anew(%22%2Ftmp%2Ffoo.txt%22).iter()%3B%0Aassert_eq!(it.next()%2C%20Some(OsStr%3A%3Anew(%26path%3A%3AMAIN_SEPARATOR.to_string())))%3B%0Aassert_eq!(it.next()%2C%20Some(OsStr%3A%3Anew(%22tmp%22)))%3B%0Aassert_eq!(it.next()%2C%20Some(OsStr%3A%3Anew(%22foo.txt%22)))%3B%0Aassert_eq!(it.next()%2C%20None)%0A%7D">Run</a></pre>
</div><h4 id='method.display' class="method"><span id='display.v' class='invisible'><code>fn <a href='#method.display' class='fnname'>display</a>(&amp;self) -&gt; <a class="struct" href="../../std/path/struct.Display.html" title="struct std::path::Display">Display</a></code></span></h4>
<div class='docblock'><p>Returns an object that implements <a href="../fmt/trait.Display.html"><code>Display</code></a> for safely printing paths
that may contain non-Unicode data.</p>

<h1 id='examples-27' class='section-header'><a href='#examples-27'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/tmp/foo.rs&quot;</span>);

<span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{}&quot;</span>, <span class="ident">path</span>.<span class="ident">display</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2Ftmp%2Ffoo.rs%22)%3B%0A%0Aprintln!(%22%7B%7D%22%2C%20path.display())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.metadata' class="method"><span id='metadata.v' class='invisible'><code>fn <a href='#method.metadata' class='fnname'>metadata</a>(&amp;self) -&gt; <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a>&lt;<a class="struct" href="../../std/fs/struct.Metadata.html" title="struct std::fs::Metadata">Metadata</a>&gt;</code><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div></span></h4>
<div class='docblock'><p>Queries the file system to get information about a file, directory, etc.</p>

<p>This function will traverse symbolic links to query information about the
destination file.</p>

<p>This is an alias to <a href="../fs/fn.metadata.html"><code>fs::metadata</code></a>.</p>

<h1 id='examples-28' class='section-header'><a href='#examples-28'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/Minas/tirith&quot;</span>);
<span class="kw">let</span> <span class="ident">metadata</span> <span class="op">=</span> <span class="ident">path</span>.<span class="ident">metadata</span>().<span class="ident">expect</span>(<span class="string">&quot;metadata call failed&quot;</span>);
<span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">metadata</span>.<span class="ident">file_type</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2FMinas%2Ftirith%22)%3B%0Alet%20metadata%20%3D%20path.metadata().expect(%22metadata%20call%20failed%22)%3B%0Aprintln!(%22%7B%3A%3F%7D%22%2C%20metadata.file_type())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.symlink_metadata' class="method"><span id='symlink_metadata.v' class='invisible'><code>fn <a href='#method.symlink_metadata' class='fnname'>symlink_metadata</a>(&amp;self) -&gt; <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a>&lt;<a class="struct" href="../../std/fs/struct.Metadata.html" title="struct std::fs::Metadata">Metadata</a>&gt;</code><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div></span></h4>
<div class='docblock'><p>Queries the metadata about a file without following symlinks.</p>

<p>This is an alias to <a href="../fs/fn.symlink_metadata.html"><code>fs::symlink_metadata</code></a>.</p>

<h1 id='examples-29' class='section-header'><a href='#examples-29'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/Minas/tirith&quot;</span>);
<span class="kw">let</span> <span class="ident">metadata</span> <span class="op">=</span> <span class="ident">path</span>.<span class="ident">symlink_metadata</span>().<span class="ident">expect</span>(<span class="string">&quot;symlink_metadata call failed&quot;</span>);
<span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">metadata</span>.<span class="ident">file_type</span>());<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2FMinas%2Ftirith%22)%3B%0Alet%20metadata%20%3D%20path.symlink_metadata().expect(%22symlink_metadata%20call%20failed%22)%3B%0Aprintln!(%22%7B%3A%3F%7D%22%2C%20metadata.file_type())%3B%0A%7D">Run</a></pre>
</div><h4 id='method.canonicalize' class="method"><span id='canonicalize.v' class='invisible'><code>fn <a href='#method.canonicalize' class='fnname'>canonicalize</a>(&amp;self) -&gt; <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a>&lt;<a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>&gt;</code><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div></span></h4>
<div class='docblock'><p>Returns the canonical form of the path with all intermediate components
normalized and symbolic links resolved.</p>

<p>This is an alias to <a href="../fs/fn.canonicalize.html"><code>fs::canonicalize</code></a>.</p>

<h1 id='examples-30' class='section-header'><a href='#examples-30'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::{<span class="ident">Path</span>, <span class="ident">PathBuf</span>};

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/foo/test/../test/bar.rs&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">path</span>.<span class="ident">canonicalize</span>().<span class="ident">unwrap</span>(), <span class="ident">PathBuf</span>::<span class="ident">from</span>(<span class="string">&quot;/foo/test/bar.rs&quot;</span>));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3A%7BPath%2C%20PathBuf%7D%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2Ffoo%2Ftest%2F..%2Ftest%2Fbar.rs%22)%3B%0Aassert_eq!(path.canonicalize().unwrap()%2C%20PathBuf%3A%3Afrom(%22%2Ffoo%2Ftest%2Fbar.rs%22))%3B%0A%7D">Run</a></pre>
</div><h4 id='method.read_link' class="method"><span id='read_link.v' class='invisible'><code>fn <a href='#method.read_link' class='fnname'>read_link</a>(&amp;self) -&gt; <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a>&lt;<a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>&gt;</code><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div></span></h4>
<div class='docblock'><p>Reads a symbolic link, returning the file that the link points to.</p>

<p>This is an alias to <a href="../fs/fn.read_link.html"><code>fs::read_link</code></a>.</p>

<h1 id='examples-31' class='section-header'><a href='#examples-31'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/laputa/sky_castle.rs&quot;</span>);
<span class="kw">let</span> <span class="ident">path_link</span> <span class="op">=</span> <span class="ident">path</span>.<span class="ident">read_link</span>().<span class="ident">expect</span>(<span class="string">&quot;read_link call failed&quot;</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2Flaputa%2Fsky_castle.rs%22)%3B%0Alet%20path_link%20%3D%20path.read_link().expect(%22read_link%20call%20failed%22)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.read_dir' class="method"><span id='read_dir.v' class='invisible'><code>fn <a href='#method.read_dir' class='fnname'>read_dir</a>(&amp;self) -&gt; <a class="type" href="../../std/io/type.Result.html" title="type std::io::Result">Result</a>&lt;<a class="struct" href="../../std/fs/struct.ReadDir.html" title="struct std::fs::ReadDir">ReadDir</a>&gt;</code><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div></span></h4>
<div class='docblock'><p>Returns an iterator over the entries within a directory.</p>

<p>The iterator will yield instances of <a href="../io/type.Result.html"><code>io::Result</code></a><code>&lt;</code><a href="../fs/struct.DirEntry.html"><code>DirEntry</code></a><code>&gt;</code>. New
errors may be encountered after an iterator is initially constructed.</p>

<p>This is an alias to <a href="../fs/fn.read_dir.html"><code>fs::read_dir</code></a>.</p>

<h1 id='examples-32' class='section-header'><a href='#examples-32'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;

<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;/laputa&quot;</span>);
<span class="kw">for</span> <span class="ident">entry</span> <span class="kw">in</span> <span class="ident">path</span>.<span class="ident">read_dir</span>().<span class="ident">expect</span>(<span class="string">&quot;read_dir call failed&quot;</span>) {
    <span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Ok</span>(<span class="ident">entry</span>) <span class="op">=</span> <span class="ident">entry</span> {
        <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">entry</span>.<span class="ident">path</span>());
    }
}<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0A%0Alet%20path%20%3D%20Path%3A%3Anew(%22%2Flaputa%22)%3B%0Afor%20entry%20in%20path.read_dir().expect(%22read_dir%20call%20failed%22)%20%7B%0A%20%20%20%20if%20let%20Ok(entry)%20%3D%20entry%20%7B%0A%20%20%20%20%20%20%20%20println!(%22%7B%3A%3F%7D%22%2C%20entry.path())%3B%0A%20%20%20%20%7D%0A%7D%0A%7D">Run</a></pre>
</div><h4 id='method.exists' class="method"><span id='exists.v' class='invisible'><code>fn <a href='#method.exists' class='fnname'>exists</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div></span></h4>
<div class='docblock'><p>Returns whether the path points at an existing entity.</p>

<p>This function will traverse symbolic links to query information about the
destination file. In case of broken symbolic links this will return <code>false</code>.</p>

<h1 id='examples-33' class='section-header'><a href='#examples-33'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;does_not_exist.txt&quot;</span>).<span class="ident">exists</span>(), <span class="bool-val">false</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0Aassert_eq!(Path%3A%3Anew(%22does_not_exist.txt%22).exists()%2C%20false)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.is_file' class="method"><span id='is_file.v' class='invisible'><code>fn <a href='#method.is_file' class='fnname'>is_file</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div></span></h4>
<div class='docblock'><p>Returns whether the path is pointing at a regular file.</p>

<p>This function will traverse symbolic links to query information about the
destination file. In case of broken symbolic links this will return <code>false</code>.</p>

<h1 id='examples-34' class='section-header'><a href='#examples-34'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;./is_a_directory/&quot;</span>).<span class="ident">is_file</span>(), <span class="bool-val">false</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;a_file.txt&quot;</span>).<span class="ident">is_file</span>(), <span class="bool-val">true</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0Aassert_eq!(Path%3A%3Anew(%22.%2Fis_a_directory%2F%22).is_file()%2C%20false)%3B%0Aassert_eq!(Path%3A%3Anew(%22a_file.txt%22).is_file()%2C%20true)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.is_dir' class="method"><span id='is_dir.v' class='invisible'><code>fn <a href='#method.is_dir' class='fnname'>is_dir</a>(&amp;self) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div></span></h4>
<div class='docblock'><p>Returns whether the path is pointing at a directory.</p>

<p>This function will traverse symbolic links to query information about the
destination file. In case of broken symbolic links this will return <code>false</code>.</p>

<h1 id='examples-35' class='section-header'><a href='#examples-35'>Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;./is_a_directory/&quot;</span>).<span class="ident">is_dir</span>(), <span class="bool-val">true</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Path</span>::<span class="ident">new</span>(<span class="string">&quot;a_file.txt&quot;</span>).<span class="ident">is_dir</span>(), <span class="bool-val">false</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Apath%3A%3APath%3B%0Aassert_eq!(Path%3A%3Anew(%22.%2Fis_a_directory%2F%22).is_dir()%2C%20true)%3B%0Aassert_eq!(Path%3A%3Anew(%22a_file.txt%22).is_dir()%2C%20false)%3B%0A%7D">Run</a></pre>
</div><h4 id='method.into_path_buf' class="method"><span id='into_path_buf.v' class='invisible'><code>fn <a href='#method.into_path_buf' class='fnname'>into_path_buf</a>(self: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API.  (<code>into_boxed_path </code><a href="https://github.com/rust-lang/rust/issues/40380">#40380</a>)</div></div><div class='docblock'><p>Converts a <a href="../../std/boxed/struct.Box.html"><code>Box&lt;Path&gt;</code></a> into a <a href="struct.PathBuf.html"><code>PathBuf</code></a> without copying or
allocating.</p>
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a> for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1081' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='../../std/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='docblock'><p>Returns a copy of the value. <a href="../../std/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='../../std/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: &amp;Self)</code></span></h4>
<div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="../../std/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.18.0'>1.18.0</div><a class='srclink' href='../../src/std/path.rs.html#1345-1349' 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>(boxed: <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='docblock'><p>Performs the conversion.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/convert/trait.Into.html" title="trait std::convert::Into">Into</a>&lt;<a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.18.0'>1.18.0</div><a class='srclink' href='../../src/std/path.rs.html#1352-1356' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.into' class="method"><span id='into.v' class='invisible'><code>fn <a href='../../std/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -&gt; <a class="struct" href="../../std/boxed/struct.Box.html" title="struct std::boxed::Box">Box</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;</code></span></h4>
<div class='docblock'><p>Performs the conversion.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, T:&nbsp;?<a class="trait" href="../../std/marker/trait.Sized.html" title="trait std::marker::Sized">Sized</a> + <a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;&gt; <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;&amp;'a T&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1359-1363' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.from-1' class="method"><span id='from.v-1' class='invisible'><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(s: &amp;'a T) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='docblock'><p>Performs the conversion.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;<a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1366-1370' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.from-2' class="method"><span id='from.v-2' class='invisible'><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(s: <a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='docblock'><p>Performs the conversion.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a>&lt;<a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1380-1384' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.from-3' class="method"><span id='from.v-3' class='invisible'><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(s: <a class="struct" href="../../std/string/struct.String.html" title="struct std::string::String">String</a>) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='docblock'><p>Performs the conversion.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;P:&nbsp;<a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt; <a class="trait" href="../../std/iter/trait.FromIterator.html" title="trait std::iter::FromIterator">FromIterator</a>&lt;P&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1387-1393' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.from_iter' class="method"><span id='from_iter.v' class='invisible'><code>fn <a href='../../std/iter/trait.FromIterator.html#tymethod.from_iter' class='fnname'>from_iter</a>&lt;I:&nbsp;<a class="trait" href="../../std/iter/trait.IntoIterator.html" title="trait std::iter::IntoIterator">IntoIterator</a>&lt;Item = P&gt;&gt;(iter: I) -&gt; <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span></h4>
<div class='docblock'><p>Creates a value from an iterator. <a href="../../std/iter/trait.FromIterator.html#tymethod.from_iter">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;P:&nbsp;<a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt; <a class="trait" href="../../std/iter/trait.Extend.html" title="trait std::iter::Extend">Extend</a>&lt;P&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1396-1402' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.extend' class="method"><span id='extend.v' class='invisible'><code>fn <a href='../../std/iter/trait.Extend.html#tymethod.extend' class='fnname'>extend</a>&lt;I:&nbsp;<a class="trait" href="../../std/iter/trait.IntoIterator.html" title="trait std::iter::IntoIterator">IntoIterator</a>&lt;Item = P&gt;&gt;(&amp;mut self, iter: I)</code></span></h4>
<div class='docblock'><p>Extends a collection with the contents of an iterator. <a href="../../std/iter/trait.Extend.html#tymethod.extend">Read more</a></p>
</div></div><h3 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/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1405-1409' 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>(&amp;self, formatter: &amp;mut <a class="struct" href="../../std/fmt/struct.Formatter.html" title="struct std::fmt::Formatter">Formatter</a>) -&gt; <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a>&lt;<a class="primitive" href="../primitive.tuple.html">()</a>, <a class="struct" href="../../std/fmt/struct.Error.html" title="struct std::fmt::Error">Error</a>&gt;</code></span></h4>
<div class='docblock'><p>Formats the value using the given formatter.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/ops/trait.Deref.html" title="trait std::ops::Deref">Deref</a> for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1412-1418' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Target' class="type"><span id='Target.t' class='invisible'><code>type <a href='../../std/ops/trait.Deref.html#associatedtype.Target' class="type">Target</a> = <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a></code></span></h4>
<div class='docblock'><p>The resulting type after dereferencing</p>
</div><h4 id='method.deref' class="method"><span id='deref.v' class='invisible'><code>fn <a href='../../std/ops/trait.Deref.html#tymethod.deref' class='fnname'>deref</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a></code></span></h4>
<div class='docblock'><p>The method called to dereference a value</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/borrow/trait.Borrow.html" title="trait std::borrow::Borrow">Borrow</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1421-1425' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.borrow' class="method"><span id='borrow.v' class='invisible'><code>fn <a href='../../std/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a></code></span></h4>
<div class='docblock'><p>Immutably borrows from an owned value. <a href="../../std/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/default/trait.Default.html" title="trait std::default::Default">Default</a> for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.17.0'>1.17.0</div><a class='srclink' href='../../src/std/path.rs.html#1428-1432' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.default' class="method"><span id='default.v' class='invisible'><code>fn <a href='../../std/default/trait.Default.html#tymethod.default' class='fnname'>default</a>() -&gt; Self</code></span></h4>
<div class='docblock'><p>Returns the &quot;default value&quot; for a type. <a href="../../std/default/trait.Default.html#tymethod.default">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a> for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1462-1466' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.eq' class="method"><span id='eq.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, other: &amp;<a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne' class="method"><span id='ne.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/hash/trait.Hash.html" title="trait std::hash::Hash">Hash</a> for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1469-1473' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.hash' class="method"><span id='hash.v' class='invisible'><code>fn <a href='../../std/hash/trait.Hash.html#tymethod.hash' class='fnname'>hash</a>&lt;H:&nbsp;<a class="trait" href="../../std/hash/trait.Hasher.html" title="trait std::hash::Hasher">Hasher</a>&gt;(&amp;self, h: &amp;mut H)</code></span></h4>
<div class='docblock'><p>Feeds this value into the given [<code>Hasher</code>]. <a href="../../std/hash/trait.Hash.html#tymethod.hash">Read more</a></p>
</div><h4 id='method.hash_slice' class="method"><span id='hash_slice.v' class='invisible'><code>fn <a href='../../std/hash/trait.Hash.html#method.hash_slice' class='fnname'>hash_slice</a>&lt;H&gt;(data: <a class="primitive" href="../primitive.slice.html">&amp;[Self]</a>, state: &amp;mut H) <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="../../std/hash/trait.Hasher.html" title="trait std::hash::Hasher">Hasher</a>,&nbsp;</span></code><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div></span></h4>
<div class='docblock'><p>Feeds a slice of this type into the given [<code>Hasher</code>]. <a href="../../std/hash/trait.Hash.html#method.hash_slice">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/cmp/trait.Eq.html" title="trait std::cmp::Eq">Eq</a> for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1476' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a> for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1479-1483' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.partial_cmp' class="method"><span id='partial_cmp.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>&gt;</code></span></h4>
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div><h4 id='method.lt' class="method"><span id='lt.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div><h4 id='method.le' class="method"><span id='le.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div><h4 id='method.gt' class="method"><span id='gt.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div><h4 id='method.ge' class="method"><span id='ge.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/cmp/trait.Ord.html" title="trait std::cmp::Ord">Ord</a> for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1486-1490' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.cmp' class="method"><span id='cmp.v' class='invisible'><code>fn <a href='../../std/cmp/trait.Ord.html#tymethod.cmp' class='fnname'>cmp</a>(&amp;self, other: &amp;<a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>) -&gt; <a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a></code></span></h4>
<div class='docblock'><p>This method returns an <code>Ordering</code> between <code>self</code> and <code>other</code>. <a href="../../std/cmp/trait.Ord.html#tymethod.cmp">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#1493-1497' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.as_ref' class="method"><span id='as_ref.v' class='invisible'><code>fn <a href='../../std/convert/trait.AsRef.html#tymethod.as_ref' class='fnname'>as_ref</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a></code></span></h4>
<div class='docblock'><p>Performs the conversion.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/convert/trait.AsRef.html" title="trait std::convert::AsRef">AsRef</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/path.rs.html#2404-2408' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.as_ref-1' class="method"><span id='as_ref.v-1' class='invisible'><code>fn <a href='../../std/convert/trait.AsRef.html#tymethod.as_ref' class='fnname'>as_ref</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a></code></span></h4>
<div class='docblock'><p>Performs the conversion.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a&gt; <a class="trait" href="../../std/iter/trait.IntoIterator.html" title="trait std::iter::IntoIterator">IntoIterator</a> for &amp;'a <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</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/path.rs.html#2411-2415' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Item' class="type"><span id='Item.t' class='invisible'><code>type <a href='../../std/iter/trait.IntoIterator.html#associatedtype.Item' class="type">Item</a> = &amp;'a <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a></code></span></h4>
<div class='docblock'><p>The type of the elements being iterated over.</p>
</div><h4 id='associatedtype.IntoIter' class="type"><span id='IntoIter.t' class='invisible'><code>type <a href='../../std/iter/trait.IntoIterator.html#associatedtype.IntoIter' class="type">IntoIter</a> = <a class="struct" href="../../std/path/struct.Iter.html" title="struct std::path::Iter">Iter</a>&lt;'a&gt;</code></span></h4>
<div class='docblock'><p>Which kind of iterator are we turning this into?</p>
</div><h4 id='method.into_iter' class="method"><span id='into_iter.v' class='invisible'><code>fn <a href='../../std/iter/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -&gt; <a class="struct" href="../../std/path/struct.Iter.html" title="struct std::path::Iter">Iter</a>&lt;'a&gt;</code></span></h4>
<div class='docblock'><p>Creates an iterator from a value. <a href="../../std/iter/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</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/path.rs.html#2427-2430' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.eq-1' class="method"><span id='eq.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, other: &amp;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne-1' class="method"><span id='ne.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.8.0'>1.8.0</div><a class='srclink' href='../../src/std/path.rs.html#2439-2444' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.partial_cmp-1' class="method"><span id='partial_cmp.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>&gt;</code></span></h4>
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div><h4 id='method.lt-1' class="method"><span id='lt.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div><h4 id='method.le-1' class="method"><span id='le.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div><h4 id='method.gt-1' class="method"><span id='gt.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div><h4 id='method.ge-1' class="method"><span id='ge.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a>&lt;&amp;'a <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</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/path.rs.html#2427-2430' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.eq-2' class="method"><span id='eq.v-2' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, other: &amp;&amp;'a <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne-2' class="method"><span id='ne.v-2' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a>&lt;&amp;'a <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.8.0'>1.8.0</div><a class='srclink' href='../../src/std/path.rs.html#2439-2444' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.partial_cmp-2' class="method"><span id='partial_cmp.v-2' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&amp;self, other: &amp;&amp;'a <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>&gt;</code></span></h4>
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div><h4 id='method.lt-2' class="method"><span id='lt.v-2' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div><h4 id='method.le-2' class="method"><span id='le.v-2' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div><h4 id='method.gt-2' class="method"><span id='gt.v-2' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div><h4 id='method.ge-2' class="method"><span id='ge.v-2' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a>&lt;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</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/path.rs.html#2433-2436' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.eq-3' class="method"><span id='eq.v-3' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, other: &amp;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne-3' class="method"><span id='ne.v-3' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a>&lt;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.8.0'>1.8.0</div><a class='srclink' href='../../src/std/path.rs.html#2447-2452' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.partial_cmp-3' class="method"><span id='partial_cmp.v-3' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&amp;self, other: &amp;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>&gt;</code></span></h4>
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div><h4 id='method.lt-3' class="method"><span id='lt.v-3' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div><h4 id='method.le-3' class="method"><span id='le.v-3' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div><h4 id='method.gt-3' class="method"><span id='gt.v-3' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div><h4 id='method.ge-3' class="method"><span id='ge.v-3' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.8.0'>1.8.0</div><a class='srclink' href='../../src/std/path.rs.html#2465-2468' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.eq-4' class="method"><span id='eq.v-4' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, other: &amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne-4' class="method"><span id='ne.v-4' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.8.0'>1.8.0</div><a class='srclink' href='../../src/std/path.rs.html#2477-2482' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.partial_cmp-4' class="method"><span id='partial_cmp.v-4' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>&gt;</code></span></h4>
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div><h4 id='method.lt-4' class="method"><span id='lt.v-4' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div><h4 id='method.le-4' class="method"><span id='le.v-4' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div><h4 id='method.gt-4' class="method"><span id='gt.v-4' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div><h4 id='method.ge-4' class="method"><span id='ge.v-4' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a>&lt;&amp;'a <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.8.0'>1.8.0</div><a class='srclink' href='../../src/std/path.rs.html#2465-2468' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.eq-5' class="method"><span id='eq.v-5' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, other: &amp;&amp;'a <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne-5' class="method"><span id='ne.v-5' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a>&lt;&amp;'a <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.8.0'>1.8.0</div><a class='srclink' href='../../src/std/path.rs.html#2477-2482' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.partial_cmp-5' class="method"><span id='partial_cmp.v-5' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&amp;self, other: &amp;&amp;'a <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>&gt;</code></span></h4>
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div><h4 id='method.lt-5' class="method"><span id='lt.v-5' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div><h4 id='method.le-5' class="method"><span id='le.v-5' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div><h4 id='method.gt-5' class="method"><span id='gt.v-5' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div><h4 id='method.ge-5' class="method"><span id='ge.v-5' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a>&lt;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.8.0'>1.8.0</div><a class='srclink' href='../../src/std/path.rs.html#2465-2468' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.eq-6' class="method"><span id='eq.v-6' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, other: &amp;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne-6' class="method"><span id='ne.v-6' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a>&lt;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.8.0'>1.8.0</div><a class='srclink' href='../../src/std/path.rs.html#2477-2482' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.partial_cmp-6' class="method"><span id='partial_cmp.v-6' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&amp;self, other: &amp;<a class="enum" href="../../std/borrow/enum.Cow.html" title="enum std::borrow::Cow">Cow</a>&lt;'a, <a class="struct" href="../../std/ffi/struct.OsStr.html" title="struct std::ffi::OsStr">OsStr</a>&gt;) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>&gt;</code></span></h4>
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div><h4 id='method.lt-6' class="method"><span id='lt.v-6' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div><h4 id='method.le-6' class="method"><span id='le.v-6' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div><h4 id='method.gt-6' class="method"><span id='gt.v-6' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div><h4 id='method.ge-6' class="method"><span id='ge.v-6' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.8.0'>1.8.0</div><a class='srclink' href='../../src/std/path.rs.html#2465-2468' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.eq-7' class="method"><span id='eq.v-7' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, other: &amp;<a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne-7' class="method"><span id='ne.v-7' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl&lt;'a, 'b&gt; <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>&gt; for <a class="struct" href="../../std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.8.0'>1.8.0</div><a class='srclink' href='../../src/std/path.rs.html#2477-2482' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.partial_cmp-7' class="method"><span id='partial_cmp.v-7' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="../../std/ffi/struct.OsString.html" title="struct std::ffi::OsString">OsString</a>) -&gt; <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a>&lt;<a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>&gt;</code></span></h4>
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div><h4 id='method.lt-7' class="method"><span id='lt.v-7' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div><h4 id='method.le-7' class="method"><span id='le.v-7' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div><h4 id='method.gt-7' class="method"><span id='gt.v-7' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div><h4 id='method.ge-7' class="method"><span id='ge.v-7' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&amp;self, other: &amp;Rhs) -&gt; <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4>
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.ge">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>?</dt>
                    <dd>Show this help dialog</dd>
                    <dt>S</dt>
                    <dd>Focus the search field</dd>
                    <dt>&larrb;</dt>
                    <dd>Move up in search results</dd>
                    <dt>&rarrb;</dt>
                    <dd>Move down in search results</dd>
                    <dt>&#9166;</dt>
                    <dd>Go to active search result</dd>
                    <dt>+</dt>
                    <dd>Collapse/expand 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>