mirror of
https://github.com/Rust-GPU/rust-gpu.git
synced 2026-06-08 10:39:50 +09:00
516 lines
119 KiB
HTML
516 lines
119 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A path to a named temporary file without an open file handle."><meta name="keywords" content="rust, rustlang, rust-lang, TempPath"><title>TempPath in tempfile - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><script defer src="../main.js"></script>
|
||
<noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="https://www.rust-lang.org/favicon.ico"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a class="sidebar-logo" href="../tempfile/index.html"><div class="logo-container"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png" alt="logo"></div>
|
||
</a><h2 class="location">Struct TempPath</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#implementations">Methods</a></h3><div class="sidebar-links"><a href="#method.close">close</a><a href="#method.keep">keep</a><a href="#method.persist">persist</a><a href="#method.persist_noclobber">persist_noclobber</a></div><h3 class="sidebar-title"><a href="#deref-methods-Path">Methods from Deref<Target=Path></a></h3><div class="sidebar-links"><a href="#method.ancestors">ancestors</a><a href="#method.as_os_str">as_os_str</a><a href="#method.canonicalize">canonicalize</a><a href="#method.components">components</a><a href="#method.display">display</a><a href="#method.ends_with">ends_with</a><a href="#method.exists">exists</a><a href="#method.extension">extension</a><a href="#method.file_name">file_name</a><a href="#method.file_prefix">file_prefix</a><a href="#method.file_stem">file_stem</a><a href="#method.has_root">has_root</a><a href="#method.is_absolute">is_absolute</a><a href="#method.is_dir">is_dir</a><a href="#method.is_file">is_file</a><a href="#method.is_relative">is_relative</a><a href="#method.is_symlink">is_symlink</a><a href="#method.iter">iter</a><a href="#method.join">join</a><a href="#method.metadata">metadata</a><a href="#method.parent">parent</a><a href="#method.read_dir">read_dir</a><a href="#method.read_link">read_link</a><a href="#method.starts_with">starts_with</a><a href="#method.strip_prefix">strip_prefix</a><a href="#method.symlink_metadata">symlink_metadata</a><a href="#method.to_path_buf">to_path_buf</a><a href="#method.to_str">to_str</a><a href="#method.to_string_lossy">to_string_lossy</a><a href="#method.try_exists">try_exists</a><a href="#method.with_extension">with_extension</a><a href="#method.with_file_name">with_file_name</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-AsRef%3COsStr%3E">AsRef<OsStr></a><a href="#impl-AsRef%3CPath%3E">AsRef<Path></a><a href="#impl-Debug">Debug</a><a href="#impl-Deref">Deref</a><a href="#impl-Drop">Drop</a><a href="#impl-From%3CPathPersistError%3E">From<PathPersistError></a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a></div></div><h2 class="location">Other items in<br><a href="index.html">tempfile</a></h2><div id="sidebar-vars" data-name="TempPath" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../tempfile/index.html"><img src="https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png" alt="logo"></a><nav class="sub"><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><form class="search-form"><div class="search-container"><div>
|
||
<input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
|
||
<h1 class="fqn"><span class="in-band">Struct <a href="index.html">tempfile</a>::<wbr><a class="struct" href="#">TempPath</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band">
|
||
<a class="srclink" href="../src/tempfile/file/mod.rs.html#140-142" title="goto source code">source</a> ·
|
||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div>
|
||
<div class="docblock item-decl"><pre class="rust struct"><code>pub struct TempPath { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A path to a named temporary file without an open file handle.</p>
|
||
<p>This is useful when the temporary file needs to be used by a child process,
|
||
for example.</p>
|
||
<p>When dropped, the temporary file is deleted.</p>
|
||
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#144-354" title="goto source code">source</a></div><a href="#impl" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.close" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#178-183" title="goto source code">source</a></div><a href="#method.close" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.close" class="fnname">close</a>(self) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Close and remove the temporary file.</p>
|
||
<p>Use this if you want to detect errors in deleting the file.</p>
|
||
<h5 id="errors" class="section-header"><a href="#errors">Errors</a></h5>
|
||
<p>If the file cannot be deleted, <code>Err</code> is returned.</p>
|
||
<h5 id="examples" class="section-header"><a href="#examples">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">tempfile::NamedTempFile</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">NamedTempFile::new</span>()<span class="question-mark">?</span>;
|
||
|
||
<span class="comment">// Close the file, but keep the path to it around.</span>
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">file</span>.<span class="ident">into_temp_path</span>();
|
||
|
||
<span class="comment">// By closing the `TempPath` explicitly, we can check that it has</span>
|
||
<span class="comment">// been deleted successfully. If we don't close it explicitly, the</span>
|
||
<span class="comment">// file will still be deleted when `file` goes out of scope, but we</span>
|
||
<span class="comment">// won't know whether deleting the file succeeded.</span>
|
||
<span class="ident">path</span>.<span class="ident">close</span>()<span class="question-mark">?</span>;</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.persist" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#228-243" title="goto source code">source</a></div><a href="#method.persist" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.persist" class="fnname">persist</a><P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>>(<br> self, <br> new_path: P<br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.PathPersistError.html" title="struct tempfile::PathPersistError">PathPersistError</a>></h4></div></summary><div class="docblock"><p>Persist the temporary file at the target path.</p>
|
||
<p>If a file exists at the target path, persist will atomically replace it.
|
||
If this method fails, it will return <code>self</code> in the resulting
|
||
<a href="struct.PathPersistError.html"><code>PathPersistError</code></a>.</p>
|
||
<p>Note: Temporary files cannot be persisted across filesystems. Also
|
||
neither the file contents nor the containing directory are
|
||
synchronized, so the update may not yet have reached the disk when
|
||
<code>persist</code> returns.</p>
|
||
<h5 id="security" class="section-header"><a href="#security">Security</a></h5>
|
||
<p>Only use this method if you’re positive that a temporary file cleaner
|
||
won’t have deleted your file. Otherwise, you might end up persisting an
|
||
attacker controlled file.</p>
|
||
<h5 id="errors-1" class="section-header"><a href="#errors-1">Errors</a></h5>
|
||
<p>If the file cannot be moved to the new location, <code>Err</code> is returned.</p>
|
||
<h5 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">tempfile::NamedTempFile</span>;
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">NamedTempFile::new</span>()<span class="question-mark">?</span>;
|
||
<span class="macro">writeln!</span>(<span class="ident">file</span>, <span class="string">"Brian was here. Briefly."</span>)<span class="question-mark">?</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">file</span>.<span class="ident">into_temp_path</span>();
|
||
<span class="ident">path</span>.<span class="ident">persist</span>(<span class="string">"./saved_file.txt"</span>)<span class="question-mark">?</span>;</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.persist_noclobber" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#287-305" title="goto source code">source</a></div><a href="#method.persist_noclobber" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.persist_noclobber" class="fnname">persist_noclobber</a><P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>>(<br> self, <br> new_path: P<br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="struct.PathPersistError.html" title="struct tempfile::PathPersistError">PathPersistError</a>></h4></div></summary><div class="docblock"><p>Persist the temporary file at the target path if and only if no file exists there.</p>
|
||
<p>If a file exists at the target path, fail. If this method fails, it will
|
||
return <code>self</code> in the resulting <a href="struct.PathPersistError.html"><code>PathPersistError</code></a>.</p>
|
||
<p>Note: Temporary files cannot be persisted across filesystems. Also Note:
|
||
This method is not atomic. It can leave the original link to the
|
||
temporary file behind.</p>
|
||
<h5 id="security-1" class="section-header"><a href="#security-1">Security</a></h5>
|
||
<p>Only use this method if you’re positive that a temporary file cleaner
|
||
won’t have deleted your file. Otherwise, you might end up persisting an
|
||
attacker controlled file.</p>
|
||
<h5 id="errors-2" class="section-header"><a href="#errors-2">Errors</a></h5>
|
||
<p>If the file cannot be moved to the new location or a file already exists
|
||
there, <code>Err</code> is returned.</p>
|
||
<h5 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">tempfile::NamedTempFile</span>;
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">NamedTempFile::new</span>()<span class="question-mark">?</span>;
|
||
<span class="macro">writeln!</span>(<span class="ident">file</span>, <span class="string">"Brian was here. Briefly."</span>)<span class="question-mark">?</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">file</span>.<span class="ident">into_temp_path</span>();
|
||
<span class="ident">path</span>.<span class="ident">persist_noclobber</span>(<span class="string">"./saved_file.txt"</span>)<span class="question-mark">?</span>;</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.keep" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#338-353" title="goto source code">source</a></div><a href="#method.keep" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.keep" class="fnname">keep</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>, <a class="struct" href="struct.PathPersistError.html" title="struct tempfile::PathPersistError">PathPersistError</a>></h4></div></summary><div class="docblock"><p>Keep the temporary file from being deleted. This function will turn the
|
||
temporary file into a non-temporary file without moving it.</p>
|
||
<h5 id="errors-3" class="section-header"><a href="#errors-3">Errors</a></h5>
|
||
<p>On some platforms (e.g., Windows), we need to mark the file as
|
||
non-temporary. This operation could fail.</p>
|
||
<h5 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">tempfile::NamedTempFile</span>;
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">NamedTempFile::new</span>()<span class="question-mark">?</span>;
|
||
<span class="macro">writeln!</span>(<span class="ident">file</span>, <span class="string">"Brian was here. Briefly."</span>)<span class="question-mark">?</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">file</span>.<span class="ident">into_temp_path</span>();
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">path</span>.<span class="ident">keep</span>()<span class="question-mark">?</span>;</code></pre></div>
|
||
</div></details></div></details><h2 id="deref-methods-Path" class="small-section-header"><span>Methods from <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = <a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>></span><a href="#deref-methods-Path" class="anchor"></a></h2><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_os_str" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#1967" title="goto source code">source</a></div><a href="#method.as_os_str" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.as_os_str" class="fnname">as_os_str</a>(&self) -> &<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a></h4></div></summary><div class="docblock"><p>Yields the underlying <a href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsStr.html" title="OsStr"><code>OsStr</code></a> slice.</p>
|
||
<h5 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">os_str</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"foo.txt"</span>).<span class="ident">as_os_str</span>();
|
||
<span class="macro">assert_eq!</span>(<span class="ident">os_str</span>, <span class="ident">std::ffi::OsStr::new</span>(<span class="string">"foo.txt"</span>));</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.to_str" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#1991" title="goto source code">source</a></div><a href="#method.to_str" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.to_str" class="fnname">to_str</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>></h4></div></summary><div class="docblock"><p>Yields a <a href="https://doc.rust-lang.org/nightly/std/primitive.str.html"><code>&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.
|
||
Note that validation is performed because non-UTF-8 strings are
|
||
perfectly valid for some OS.</p>
|
||
<h5 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"foo.txt"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">to_str</span>(), <span class="prelude-val">Some</span>(<span class="string">"foo.txt"</span>));</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.to_string_lossy" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2019" title="goto source code">source</a></div><a href="#method.to_string_lossy" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.to_string_lossy" class="fnname">to_string_lossy</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'_, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>></h4></div></summary><div class="docblock"><p>Converts a <code>Path</code> to a <a href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="Cow<str>"><code>Cow<str></code></a>.</p>
|
||
<p>Any non-Unicode sequences are replaced with
|
||
<a href="https://doc.rust-lang.org/nightly/core/char/constant.REPLACEMENT_CHARACTER.html"><code>U+FFFD REPLACEMENT CHARACTER</code></a>.</p>
|
||
<h5 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h5>
|
||
<p>Calling <code>to_string_lossy</code> on a <code>Path</code> with valid unicode:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"foo.txt"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">to_string_lossy</span>(), <span class="string">"foo.txt"</span>);</code></pre></div>
|
||
<p>Had <code>path</code> contained invalid unicode, the <code>to_string_lossy</code> call might
|
||
have returned <code>"fo<EFBFBD>.txt"</code>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.to_path_buf" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2037" title="goto source code">source</a></div><a href="#method.to_path_buf" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.to_path_buf" class="fnname">to_path_buf</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a></h4></div></summary><div class="docblock"><p>Converts a <code>Path</code> to an owned <a href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="PathBuf"><code>PathBuf</code></a>.</p>
|
||
<h5 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path_buf</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"foo.txt"</span>).<span class="ident">to_path_buf</span>();
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path_buf</span>, <span class="ident">std::path::PathBuf::from</span>(<span class="string">"foo.txt"</span>));</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_absolute" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2062" title="goto source code">source</a></div><a href="#method.is_absolute" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.is_absolute" class="fnname">is_absolute</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></div></summary><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="https://doc.rust-lang.org/nightly/std/path/struct.Path.html#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>
|
||
<h5 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">Path::new</span>(<span class="string">"foo.txt"</span>).<span class="ident">is_absolute</span>());</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_relative" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2087" title="goto source code">source</a></div><a href="#method.is_relative" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.is_relative" class="fnname">is_relative</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></div></summary><div class="docblock"><p>Returns <code>true</code> if the <code>Path</code> is relative, i.e., not absolute.</p>
|
||
<p>See <a href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html#method.is_absolute"><code>is_absolute</code></a>’s documentation for more details.</p>
|
||
<h5 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="macro">assert!</span>(<span class="ident">Path::new</span>(<span class="string">"foo.txt"</span>).<span class="ident">is_relative</span>());</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.has_root" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2114" title="goto source code">source</a></div><a href="#method.has_root" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.has_root" class="fnname">has_root</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></div></summary><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>
|
||
<h5 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="macro">assert!</span>(<span class="ident">Path::new</span>(<span class="string">"/etc/passwd"</span>).<span class="ident">has_root</span>());</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.parent" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2137" title="goto source code">source</a></div><a href="#method.parent" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.parent" class="fnname">parent</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>></h4></div></summary><div class="docblock"><p>Returns the <code>Path</code> without its final component, if there is one.</p>
|
||
<p>Returns <a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="None"><code>None</code></a> if the path terminates in a root or prefix.</p>
|
||
<h5 id="examples-11" class="section-header"><a href="#examples-11">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"/foo/bar"</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="ident">parent</span>, <span class="ident">Path::new</span>(<span class="string">"/foo"</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="ident">grand_parent</span>, <span class="ident">Path::new</span>(<span class="string">"/"</span>));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">grand_parent</span>.<span class="ident">parent</span>(), <span class="prelude-val">None</span>);</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.ancestors" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.28.0">1.28.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2178" title="goto source code">source</a></div><a href="#method.ancestors" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.ancestors" class="fnname">ancestors</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Ancestors.html" title="struct std::path::Ancestors">Ancestors</a><'_></h4></div></summary><div class="docblock"><p>Produces an iterator over <code>Path</code> and its ancestors.</p>
|
||
<p>The iterator will yield the <code>Path</code> that is returned if the <a href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html#method.parent"><code>parent</code></a> method is used zero
|
||
or more times. That means, the iterator will yield <code>&self</code>, <code>&self.parent().unwrap()</code>,
|
||
<code>&self.parent().unwrap().parent().unwrap()</code> and so on. If the <a href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html#method.parent"><code>parent</code></a> method returns
|
||
<a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="None"><code>None</code></a>, the iterator will do likewise. The iterator will always yield at least one value,
|
||
namely <code>&self</code>.</p>
|
||
<h5 id="examples-12" class="section-header"><a href="#examples-12">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">ancestors</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"/foo/bar"</span>).<span class="ident">ancestors</span>();
|
||
<span class="macro">assert_eq!</span>(<span class="ident">ancestors</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Path::new</span>(<span class="string">"/foo/bar"</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">ancestors</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Path::new</span>(<span class="string">"/foo"</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">ancestors</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Path::new</span>(<span class="string">"/"</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">ancestors</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>);
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">ancestors</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"../foo/bar"</span>).<span class="ident">ancestors</span>();
|
||
<span class="macro">assert_eq!</span>(<span class="ident">ancestors</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Path::new</span>(<span class="string">"../foo/bar"</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">ancestors</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Path::new</span>(<span class="string">"../foo"</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">ancestors</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Path::new</span>(<span class="string">".."</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">ancestors</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Path::new</span>(<span class="string">""</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">ancestors</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>);</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.file_name" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2204" title="goto source code">source</a></div><a href="#method.file_name" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.file_name" class="fnname">file_name</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>></h4></div></summary><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’s the path of a directory, this
|
||
is the directory name.</p>
|
||
<p>Returns <a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="None"><code>None</code></a> if the path terminates in <code>..</code>.</p>
|
||
<h5 id="examples-13" class="section-header"><a href="#examples-13">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
<span class="kw">use</span> <span class="ident">std::ffi::OsStr</span>;
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="ident">OsStr::new</span>(<span class="string">"bin"</span>)), <span class="ident">Path::new</span>(<span class="string">"/usr/bin/"</span>).<span class="ident">file_name</span>());
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="ident">OsStr::new</span>(<span class="string">"foo.txt"</span>)), <span class="ident">Path::new</span>(<span class="string">"tmp/foo.txt"</span>).<span class="ident">file_name</span>());
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="ident">OsStr::new</span>(<span class="string">"foo.txt"</span>)), <span class="ident">Path::new</span>(<span class="string">"foo.txt/."</span>).<span class="ident">file_name</span>());
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="ident">OsStr::new</span>(<span class="string">"foo.txt"</span>)), <span class="ident">Path::new</span>(<span class="string">"foo.txt/.//"</span>).<span class="ident">file_name</span>());
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, <span class="ident">Path::new</span>(<span class="string">"foo.txt/.."</span>).<span class="ident">file_name</span>());
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, <span class="ident">Path::new</span>(<span class="string">"/"</span>).<span class="ident">file_name</span>());</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.strip_prefix" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.7.0">1.7.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2240-2242" title="goto source code">source</a></div><a href="#method.strip_prefix" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.strip_prefix" class="fnname">strip_prefix</a><P>(&self, base: P) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.StripPrefixError.html" title="struct std::path::StripPrefixError">StripPrefixError</a>> <span class="where fmt-newline">where<br> P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>, </span></h4></div></summary><div class="docblock"><p>Returns a path that, when joined onto <code>base</code>, yields <code>self</code>.</p>
|
||
<h5 id="errors-4" class="section-header"><a href="#errors-4">Errors</a></h5>
|
||
<p>If <code>base</code> is not a prefix of <code>self</code> (i.e., <a href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html#method.starts_with"><code>starts_with</code></a>
|
||
returns <code>false</code>), returns <a href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html#variant.Err" title="Err"><code>Err</code></a>.</p>
|
||
<h5 id="examples-14" class="section-header"><a href="#examples-14">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::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::new</span>(<span class="string">"/test/haha/foo.txt"</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">strip_prefix</span>(<span class="string">"/"</span>), <span class="prelude-val">Ok</span>(<span class="ident">Path::new</span>(<span class="string">"test/haha/foo.txt"</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">strip_prefix</span>(<span class="string">"/test"</span>), <span class="prelude-val">Ok</span>(<span class="ident">Path::new</span>(<span class="string">"haha/foo.txt"</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">strip_prefix</span>(<span class="string">"/test/"</span>), <span class="prelude-val">Ok</span>(<span class="ident">Path::new</span>(<span class="string">"haha/foo.txt"</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">strip_prefix</span>(<span class="string">"/test/haha/foo.txt"</span>), <span class="prelude-val">Ok</span>(<span class="ident">Path::new</span>(<span class="string">""</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">strip_prefix</span>(<span class="string">"/test/haha/foo.txt/"</span>), <span class="prelude-val">Ok</span>(<span class="ident">Path::new</span>(<span class="string">""</span>)));
|
||
|
||
<span class="macro">assert!</span>(<span class="ident">path</span>.<span class="ident">strip_prefix</span>(<span class="string">"test"</span>).<span class="ident">is_err</span>());
|
||
<span class="macro">assert!</span>(<span class="ident">path</span>.<span class="ident">strip_prefix</span>(<span class="string">"/haha"</span>).<span class="ident">is_err</span>());
|
||
|
||
<span class="kw">let</span> <span class="ident">prefix</span> <span class="op">=</span> <span class="ident">PathBuf::from</span>(<span class="string">"/test/"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">strip_prefix</span>(<span class="ident">prefix</span>), <span class="prelude-val">Ok</span>(<span class="ident">Path::new</span>(<span class="string">"haha/foo.txt"</span>)));</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.starts_with" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2277" title="goto source code">source</a></div><a href="#method.starts_with" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.starts_with" class="fnname">starts_with</a><P>(&self, base: P) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br> P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>, </span></h4></div></summary><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>
|
||
<h5 id="examples-15" class="section-header"><a href="#examples-15">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"/etc/passwd"</span>);
|
||
|
||
<span class="macro">assert!</span>(<span class="ident">path</span>.<span class="ident">starts_with</span>(<span class="string">"/etc"</span>));
|
||
<span class="macro">assert!</span>(<span class="ident">path</span>.<span class="ident">starts_with</span>(<span class="string">"/etc/"</span>));
|
||
<span class="macro">assert!</span>(<span class="ident">path</span>.<span class="ident">starts_with</span>(<span class="string">"/etc/passwd"</span>));
|
||
<span class="macro">assert!</span>(<span class="ident">path</span>.<span class="ident">starts_with</span>(<span class="string">"/etc/passwd/"</span>)); <span class="comment">// extra slash is okay</span>
|
||
<span class="macro">assert!</span>(<span class="ident">path</span>.<span class="ident">starts_with</span>(<span class="string">"/etc/passwd///"</span>)); <span class="comment">// multiple extra slashes are okay</span>
|
||
|
||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">path</span>.<span class="ident">starts_with</span>(<span class="string">"/e"</span>));
|
||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">path</span>.<span class="ident">starts_with</span>(<span class="string">"/etc/passwd.txt"</span>));
|
||
|
||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">Path::new</span>(<span class="string">"/etc/foo.rs"</span>).<span class="ident">starts_with</span>(<span class="string">"/etc/foo"</span>));</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.ends_with" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2305" title="goto source code">source</a></div><a href="#method.ends_with" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.ends_with" class="fnname">ends_with</a><P>(&self, child: P) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br> P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>, </span></h4></div></summary><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>
|
||
<h5 id="examples-16" class="section-header"><a href="#examples-16">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"/etc/resolv.conf"</span>);
|
||
|
||
<span class="macro">assert!</span>(<span class="ident">path</span>.<span class="ident">ends_with</span>(<span class="string">"resolv.conf"</span>));
|
||
<span class="macro">assert!</span>(<span class="ident">path</span>.<span class="ident">ends_with</span>(<span class="string">"etc/resolv.conf"</span>));
|
||
<span class="macro">assert!</span>(<span class="ident">path</span>.<span class="ident">ends_with</span>(<span class="string">"/etc/resolv.conf"</span>));
|
||
|
||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">path</span>.<span class="ident">ends_with</span>(<span class="string">"/resolv.conf"</span>));
|
||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">path</span>.<span class="ident">ends_with</span>(<span class="string">"conf"</span>)); <span class="comment">// use .extension() instead</span></code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.file_stem" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2341" title="goto source code">source</a></div><a href="#method.file_stem" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.file_stem" class="fnname">file_stem</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>></h4></div></summary><div class="docblock"><p>Extracts the stem (non-extension) portion of <a href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html#method.file_name"><code>self.file_name</code></a>.</p>
|
||
<p>The stem is:</p>
|
||
<ul>
|
||
<li><a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="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>
|
||
<h5 id="examples-17" class="section-header"><a href="#examples-17">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="string">"foo"</span>, <span class="ident">Path::new</span>(<span class="string">"foo.rs"</span>).<span class="ident">file_stem</span>().<span class="ident">unwrap</span>());
|
||
<span class="macro">assert_eq!</span>(<span class="string">"foo.tar"</span>, <span class="ident">Path::new</span>(<span class="string">"foo.tar.gz"</span>).<span class="ident">file_stem</span>().<span class="ident">unwrap</span>());</code></pre></div>
|
||
<h5 id="see-also" class="section-header"><a href="#see-also">See Also</a></h5>
|
||
<p>This method is similar to <a href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html#method.file_prefix"><code>Path::file_prefix</code></a>, which extracts the portion of the file name
|
||
before the <em>first</em> <code>.</code></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.file_prefix" class="method has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2375" title="goto source code">source</a></div><a href="#method.file_prefix" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.file_prefix" class="fnname">file_prefix</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>></h4></div><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>path_file_prefix</code>)</div></div></summary><div class="docblock"><p>Extracts the prefix of <a href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html#method.file_name"><code>self.file_name</code></a>.</p>
|
||
<p>The prefix is:</p>
|
||
<ul>
|
||
<li><a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="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 portion of the file name before the first non-beginning <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>The portion of the file name before the second <code>.</code> if the file name begins with <code>.</code></li>
|
||
</ul>
|
||
<h5 id="examples-18" class="section-header"><a href="#examples-18">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="string">"foo"</span>, <span class="ident">Path::new</span>(<span class="string">"foo.rs"</span>).<span class="ident">file_prefix</span>().<span class="ident">unwrap</span>());
|
||
<span class="macro">assert_eq!</span>(<span class="string">"foo"</span>, <span class="ident">Path::new</span>(<span class="string">"foo.tar.gz"</span>).<span class="ident">file_prefix</span>().<span class="ident">unwrap</span>());</code></pre></div>
|
||
<h5 id="see-also-1" class="section-header"><a href="#see-also-1">See Also</a></h5>
|
||
<p>This method is similar to <a href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html#method.file_stem"><code>Path::file_stem</code></a>, which extracts the portion of the file name
|
||
before the <em>last</em> <code>.</code></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.extension" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2400" title="goto source code">source</a></div><a href="#method.extension" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.extension" class="fnname">extension</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>></h4></div></summary><div class="docblock"><p>Extracts the extension of <a href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html#method.file_name"><code>self.file_name</code></a>, if possible.</p>
|
||
<p>The extension is:</p>
|
||
<ul>
|
||
<li><a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="None"><code>None</code></a>, if there is no file name;</li>
|
||
<li><a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="None"><code>None</code></a>, if there is no embedded <code>.</code>;</li>
|
||
<li><a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="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>
|
||
<h5 id="examples-19" class="section-header"><a href="#examples-19">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="string">"rs"</span>, <span class="ident">Path::new</span>(<span class="string">"foo.rs"</span>).<span class="ident">extension</span>().<span class="ident">unwrap</span>());
|
||
<span class="macro">assert_eq!</span>(<span class="string">"gz"</span>, <span class="ident">Path::new</span>(<span class="string">"foo.tar.gz"</span>).<span class="ident">extension</span>().<span class="ident">unwrap</span>());</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.join" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2417" title="goto source code">source</a></div><a href="#method.join" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.join" class="fnname">join</a><P>(&self, path: P) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a> <span class="where fmt-newline">where<br> P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>>, </span></h4></div></summary><div class="docblock"><p>Creates an owned <a href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="PathBuf"><code>PathBuf</code></a> with <code>path</code> adjoined to <code>self</code>.</p>
|
||
<p>See <a href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html#method.push" title="PathBuf::push"><code>PathBuf::push</code></a> for more details on what it means to adjoin a path.</p>
|
||
<h5 id="examples-20" class="section-header"><a href="#examples-20">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path</span>::{<span class="ident">Path</span>, <span class="ident">PathBuf</span>};
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="ident">Path::new</span>(<span class="string">"/etc"</span>).<span class="ident">join</span>(<span class="string">"passwd"</span>), <span class="ident">PathBuf::from</span>(<span class="string">"/etc/passwd"</span>));</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_file_name" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2444" title="goto source code">source</a></div><a href="#method.with_file_name" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.with_file_name" class="fnname">with_file_name</a><S>(&self, file_name: S) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a> <span class="where fmt-newline">where<br> S: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>>, </span></h4></div></summary><div class="docblock"><p>Creates an owned <a href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="PathBuf"><code>PathBuf</code></a> like <code>self</code> but with the given file name.</p>
|
||
<p>See <a href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html#method.set_file_name" title="PathBuf::set_file_name"><code>PathBuf::set_file_name</code></a> for more details.</p>
|
||
<h5 id="examples-21" class="section-header"><a href="#examples-21">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::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::new</span>(<span class="string">"/tmp/foo.txt"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">with_file_name</span>(<span class="string">"bar.txt"</span>), <span class="ident">PathBuf::from</span>(<span class="string">"/tmp/bar.txt"</span>));
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"/tmp"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">with_file_name</span>(<span class="string">"var"</span>), <span class="ident">PathBuf::from</span>(<span class="string">"/var"</span>));</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_extension" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2472" title="goto source code">source</a></div><a href="#method.with_extension" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.with_extension" class="fnname">with_extension</a><S>(&self, extension: S) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a> <span class="where fmt-newline">where<br> S: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>>, </span></h4></div></summary><div class="docblock"><p>Creates an owned <a href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="PathBuf"><code>PathBuf</code></a> like <code>self</code> but with the given extension.</p>
|
||
<p>See <a href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html#method.set_extension" title="PathBuf::set_extension"><code>PathBuf::set_extension</code></a> for more details.</p>
|
||
<h5 id="examples-22" class="section-header"><a href="#examples-22">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::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::new</span>(<span class="string">"foo.rs"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">with_extension</span>(<span class="string">"txt"</span>), <span class="ident">PathBuf::from</span>(<span class="string">"foo.txt"</span>));
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"foo.tar.gz"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">with_extension</span>(<span class="string">""</span>), <span class="ident">PathBuf::from</span>(<span class="string">"foo.tar"</span>));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">with_extension</span>(<span class="string">"xz"</span>), <span class="ident">PathBuf::from</span>(<span class="string">"foo.tar.xz"</span>));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">with_extension</span>(<span class="string">""</span>).<span class="ident">with_extension</span>(<span class="string">"txt"</span>), <span class="ident">PathBuf::from</span>(<span class="string">"foo.txt"</span>));</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.components" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2516" title="goto source code">source</a></div><a href="#method.components" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.components" class="fnname">components</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Components.html" title="struct std::path::Components">Components</a><'_></h4></div></summary><div class="docblock"><p>Produces an iterator over the <a href="https://doc.rust-lang.org/nightly/std/path/enum.Component.html" title="Component"><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>Occurrences of <code>.</code> are normalized away, except 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="https://doc.rust-lang.org/nightly/std/path/enum.Component.html#variant.CurDir"><code>CurDir</code></a> component.</p>
|
||
</li>
|
||
<li>
|
||
<p>A trailing slash is normalized away, <code>/a/b</code> and <code>/a/b/</code> are equivalent.</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’t <code>a</code>).</p>
|
||
<h5 id="examples-23" class="section-header"><a href="#examples-23">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path</span>::{<span class="ident">Path</span>, <span class="ident">Component</span>};
|
||
<span class="kw">use</span> <span class="ident">std::ffi::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::new</span>(<span class="string">"/tmp/foo.txt"</span>).<span class="ident">components</span>();
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="ident">components</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Component::RootDir</span>));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">components</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Component::Normal</span>(<span class="ident">OsStr::new</span>(<span class="string">"tmp"</span>))));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">components</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">Component::Normal</span>(<span class="ident">OsStr::new</span>(<span class="string">"foo.txt"</span>))));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">components</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>)</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.iter" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2550" title="goto source code">source</a></div><a href="#method.iter" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.iter" class="fnname">iter</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Iter.html" title="struct std::path::Iter">Iter</a><'_></h4></div></summary><div class="docblock"><p>Produces an iterator over the path’s components viewed as <a href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsStr.html" title="OsStr"><code>OsStr</code></a>
|
||
slices.</p>
|
||
<p>For more information about the particulars of how the path is separated
|
||
into components, see <a href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html#method.components"><code>components</code></a>.</p>
|
||
<h5 id="examples-24" class="section-header"><a href="#examples-24">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path</span>::{<span class="self">self</span>, <span class="ident">Path</span>};
|
||
<span class="kw">use</span> <span class="ident">std::ffi::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::new</span>(<span class="string">"/tmp/foo.txt"</span>).<span class="ident">iter</span>();
|
||
<span class="macro">assert_eq!</span>(<span class="ident">it</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">OsStr::new</span>(<span class="kw-2">&</span><span class="ident">path::MAIN_SEPARATOR</span>.<span class="ident">to_string</span>())));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">it</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">OsStr::new</span>(<span class="string">"tmp"</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">it</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="ident">OsStr::new</span>(<span class="string">"foo.txt"</span>)));
|
||
<span class="macro">assert_eq!</span>(<span class="ident">it</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>)</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.display" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2574" title="goto source code">source</a></div><a href="#method.display" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.display" class="fnname">display</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Display.html" title="struct std::path::Display">Display</a><'_></h4></div></summary><div class="docblock"><p>Returns an object that implements <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html"><code>Display</code></a> for safely printing paths
|
||
that may contain non-Unicode data. This may perform lossy conversion,
|
||
depending on the platform. If you would like an implementation which
|
||
escapes the path please use <a href="https://doc.rust-lang.org/nightly/core/fmt/macros/derive.Debug.html" title="Debug"><code>Debug</code></a> instead.</p>
|
||
<h5 id="examples-25" class="section-header"><a href="#examples-25">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"/tmp/foo.rs"</span>);
|
||
|
||
<span class="macro">println!</span>(<span class="string">"{}"</span>, <span class="ident">path</span>.<span class="ident">display</span>());</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.metadata" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2596" title="goto source code">source</a></div><a href="#method.metadata" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.metadata" class="fnname">metadata</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.Metadata.html" title="struct std::fs::Metadata">Metadata</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><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="https://doc.rust-lang.org/nightly/std/fs/fn.metadata.html" title="fs::metadata"><code>fs::metadata</code></a>.</p>
|
||
<h5 id="examples-26" class="section-header"><a href="#examples-26">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"/Minas/tirith"</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">"metadata call failed"</span>);
|
||
<span class="macro">println!</span>(<span class="string">"{:?}"</span>, <span class="ident">metadata</span>.<span class="ident">file_type</span>());</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.symlink_metadata" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2615" title="goto source code">source</a></div><a href="#method.symlink_metadata" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.symlink_metadata" class="fnname">symlink_metadata</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.Metadata.html" title="struct std::fs::Metadata">Metadata</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class="docblock"><p>Queries the metadata about a file without following symlinks.</p>
|
||
<p>This is an alias to <a href="https://doc.rust-lang.org/nightly/std/fs/fn.symlink_metadata.html" title="fs::symlink_metadata"><code>fs::symlink_metadata</code></a>.</p>
|
||
<h5 id="examples-27" class="section-header"><a href="#examples-27">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"/Minas/tirith"</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">"symlink_metadata call failed"</span>);
|
||
<span class="macro">println!</span>(<span class="string">"{:?}"</span>, <span class="ident">metadata</span>.<span class="ident">file_type</span>());</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.canonicalize" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2634" title="goto source code">source</a></div><a href="#method.canonicalize" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.canonicalize" class="fnname">canonicalize</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class="docblock"><p>Returns the canonical, absolute form of the path with all intermediate
|
||
components normalized and symbolic links resolved.</p>
|
||
<p>This is an alias to <a href="https://doc.rust-lang.org/nightly/std/fs/fn.canonicalize.html" title="fs::canonicalize"><code>fs::canonicalize</code></a>.</p>
|
||
<h5 id="examples-28" class="section-header"><a href="#examples-28">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::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::new</span>(<span class="string">"/foo/test/../test/bar.rs"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="ident">path</span>.<span class="ident">canonicalize</span>().<span class="ident">unwrap</span>(), <span class="ident">PathBuf::from</span>(<span class="string">"/foo/test/bar.rs"</span>));</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_link" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2652" title="goto source code">source</a></div><a href="#method.read_link" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.read_link" class="fnname">read_link</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><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="https://doc.rust-lang.org/nightly/std/fs/fn.read_link.html" title="fs::read_link"><code>fs::read_link</code></a>.</p>
|
||
<h5 id="examples-29" class="section-header"><a href="#examples-29">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"/laputa/sky_castle.rs"</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">"read_link call failed"</span>);</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_dir" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2677" title="goto source code">source</a></div><a href="#method.read_dir" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.read_dir" class="fnname">read_dir</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/fs/struct.ReadDir.html" title="struct std::fs::ReadDir">ReadDir</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class="docblock"><p>Returns an iterator over the entries within a directory.</p>
|
||
<p>The iterator will yield instances of <code><a href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="io::Result">io::Result</a><<a href="https://doc.rust-lang.org/nightly/std/fs/struct.DirEntry.html" title="fs::DirEntry">fs::DirEntry</a>></code>. New
|
||
errors may be encountered after an iterator is initially constructed.</p>
|
||
<p>This is an alias to <a href="https://doc.rust-lang.org/nightly/std/fs/fn.read_dir.html" title="fs::read_dir"><code>fs::read_dir</code></a>.</p>
|
||
<h5 id="examples-30" class="section-header"><a href="#examples-30">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"/laputa"</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">"read_dir call failed"</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="string">"{:?}"</span>, <span class="ident">entry</span>.<span class="ident">path</span>());
|
||
}
|
||
}</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.exists" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2703" title="goto source code">source</a></div><a href="#method.exists" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.exists" class="fnname">exists</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></div></summary><div class="docblock"><p>Returns <code>true</code> if the path points at an existing entity.</p>
|
||
<p>This function will traverse symbolic links to query information about the
|
||
destination file.</p>
|
||
<p>If you cannot access the metadata of the file, e.g. because of a
|
||
permission error or broken symbolic links, this will return <code>false</code>.</p>
|
||
<h5 id="examples-31" class="section-header"><a href="#examples-31">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">Path::new</span>(<span class="string">"does_not_exist.txt"</span>).<span class="ident">exists</span>());</code></pre></div>
|
||
<h5 id="see-also-2" class="section-header"><a href="#see-also-2">See Also</a></h5>
|
||
<p>This is a convenience function that coerces errors to false. If you want to
|
||
check errors, call <a href="https://doc.rust-lang.org/nightly/std/fs/fn.metadata.html" title="fs::metadata"><code>fs::metadata</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_exists" class="method has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2729" title="goto source code">source</a></div><a href="#method.try_exists" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.try_exists" class="fnname">try_exists</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>path_try_exists</code>)</div></div></summary><div class="docblock"><p>Returns <code>Ok(true)</code> if 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>Ok(false)</code>.</p>
|
||
<p>As opposed to the <code>exists()</code> method, this one doesn’t silently ignore errors
|
||
unrelated to the path not existing. (E.g. it will return <code>Err(_)</code> in case of permission
|
||
denied on some of the parent directories.)</p>
|
||
<h5 id="examples-32" class="section-header"><a href="#examples-32">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![<span class="ident">feature</span>(<span class="ident">path_try_exists</span>)]</span>
|
||
|
||
<span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">Path::new</span>(<span class="string">"does_not_exist.txt"</span>).<span class="ident">try_exists</span>().<span class="ident">expect</span>(<span class="string">"Can't check existence of file does_not_exist.txt"</span>));
|
||
<span class="macro">assert!</span>(<span class="ident">Path::new</span>(<span class="string">"/root/secret_file.txt"</span>).<span class="ident">try_exists</span>().<span class="ident">is_err</span>());</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_file" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2762" title="goto source code">source</a></div><a href="#method.is_file" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.is_file" class="fnname">is_file</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></div></summary><div class="docblock"><p>Returns <code>true</code> if the path exists on disk and is pointing at a regular file.</p>
|
||
<p>This function will traverse symbolic links to query information about the
|
||
destination file.</p>
|
||
<p>If you cannot access the metadata of the file, e.g. because of a
|
||
permission error or broken symbolic links, this will return <code>false</code>.</p>
|
||
<h5 id="examples-33" class="section-header"><a href="#examples-33">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
<span class="macro">assert_eq!</span>(<span class="ident">Path::new</span>(<span class="string">"./is_a_directory/"</span>).<span class="ident">is_file</span>(), <span class="bool-val">false</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="ident">Path::new</span>(<span class="string">"a_file.txt"</span>).<span class="ident">is_file</span>(), <span class="bool-val">true</span>);</code></pre></div>
|
||
<h5 id="see-also-3" class="section-header"><a href="#see-also-3">See Also</a></h5>
|
||
<p>This is a convenience function that coerces errors to false. If you want to
|
||
check errors, call <a href="https://doc.rust-lang.org/nightly/std/fs/fn.metadata.html" title="fs::metadata"><code>fs::metadata</code></a> and handle its <a href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="Result"><code>Result</code></a>. Then call
|
||
<a href="https://doc.rust-lang.org/nightly/std/fs/struct.Metadata.html#method.is_file" title="fs::Metadata::is_file"><code>fs::Metadata::is_file</code></a> if it was <a href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html#variant.Ok" title="Ok"><code>Ok</code></a>.</p>
|
||
<p>When the goal is simply to read from (or write to) the source, the most
|
||
reliable way to test the source can be read (or written to) is to open
|
||
it. Only using <code>is_file</code> can break workflows like <code>diff <( prog_a )</code> on
|
||
a Unix-like system for example. See <a href="https://doc.rust-lang.org/nightly/std/fs/struct.File.html#method.open" title="fs::File::open"><code>fs::File::open</code></a> or
|
||
<a href="https://doc.rust-lang.org/nightly/std/fs/struct.OpenOptions.html#method.open" title="fs::OpenOptions::open"><code>fs::OpenOptions::open</code></a> for more information.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_dir" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2789" title="goto source code">source</a></div><a href="#method.is_dir" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.is_dir" class="fnname">is_dir</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></div></summary><div class="docblock"><p>Returns <code>true</code> if the path exists on disk and is pointing at a directory.</p>
|
||
<p>This function will traverse symbolic links to query information about the
|
||
destination file.</p>
|
||
<p>If you cannot access the metadata of the file, e.g. because of a
|
||
permission error or broken symbolic links, this will return <code>false</code>.</p>
|
||
<h5 id="examples-34" class="section-header"><a href="#examples-34">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
<span class="macro">assert_eq!</span>(<span class="ident">Path::new</span>(<span class="string">"./is_a_directory/"</span>).<span class="ident">is_dir</span>(), <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="ident">Path::new</span>(<span class="string">"a_file.txt"</span>).<span class="ident">is_dir</span>(), <span class="bool-val">false</span>);</code></pre></div>
|
||
<h5 id="see-also-4" class="section-header"><a href="#see-also-4">See Also</a></h5>
|
||
<p>This is a convenience function that coerces errors to false. If you want to
|
||
check errors, call <a href="https://doc.rust-lang.org/nightly/std/fs/fn.metadata.html" title="fs::metadata"><code>fs::metadata</code></a> and handle its <a href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="Result"><code>Result</code></a>. Then call
|
||
<a href="https://doc.rust-lang.org/nightly/std/fs/struct.Metadata.html#method.is_dir" title="fs::Metadata::is_dir"><code>fs::Metadata::is_dir</code></a> if it was <a href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html#variant.Ok" title="Ok"><code>Ok</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_symlink" class="method has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.58.0">1.58.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/path.rs.html#2821" title="goto source code">source</a></div><a href="#method.is_symlink" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.is_symlink" class="fnname">is_symlink</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></div></summary><div class="docblock"><p>Returns <code>true</code> if the path exists on disk and is pointing at a symbolic link.</p>
|
||
<p>This function will not traverse symbolic links.
|
||
In case of a broken symbolic link this will also return true.</p>
|
||
<p>If you cannot access the directory containing the file, e.g., because of a
|
||
permission error, this will return false.</p>
|
||
<h5 id="examples-35" class="section-header"><a href="#examples-35">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||
<span class="kw">use</span> <span class="ident">std::os::unix::fs::symlink</span>;
|
||
|
||
<span class="kw">let</span> <span class="ident">link_path</span> <span class="op">=</span> <span class="ident">Path::new</span>(<span class="string">"link"</span>);
|
||
<span class="ident">symlink</span>(<span class="string">"/origin_does_not_exists/"</span>, <span class="ident">link_path</span>).<span class="ident">unwrap</span>();
|
||
<span class="macro">assert_eq!</span>(<span class="ident">link_path</span>.<span class="ident">is_symlink</span>(), <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="ident">link_path</span>.<span class="ident">exists</span>(), <span class="bool-val">false</span>);</code></pre></div>
|
||
<h5 id="see-also-5" class="section-header"><a href="#see-also-5">See Also</a></h5>
|
||
<p>This is a convenience function that coerces errors to false. If you want to
|
||
check errors, call <a href="https://doc.rust-lang.org/nightly/std/fs/fn.symlink_metadata.html" title="fs::symlink_metadata"><code>fs::symlink_metadata</code></a> and handle its <a href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="Result"><code>Result</code></a>. Then call
|
||
<a href="https://doc.rust-lang.org/nightly/std/fs/struct.Metadata.html#method.is_symlink" title="fs::Metadata::is_symlink"><code>fs::Metadata::is_symlink</code></a> if it was <a href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html#variant.Ok" title="Ok"><code>Ok</code></a>.</p>
|
||
</div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-AsRef%3COsStr%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#382-386" title="goto source code">source</a></div><a href="#impl-AsRef%3COsStr%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>> for <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_ref-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#383-385" title="goto source code">source</a></div><a href="#method.as_ref-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html#tymethod.as_ref" class="fnname">as_ref</a>(&self) -> &<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-AsRef%3CPath%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#376-380" title="goto source code">source</a></div><a href="#impl-AsRef%3CPath%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>> for <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_ref" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#377-379" title="goto source code">source</a></div><a href="#method.as_ref" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html#tymethod.as_ref" class="fnname">as_ref</a>(&self) -> &<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Debug" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#356-360" title="goto source code">source</a></div><a href="#impl-Debug" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#357-359" title="goto source code">source</a></div><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Deref" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#368-374" title="goto source code">source</a></div><a href="#impl-Deref" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Target" class="type trait-impl has-srclink"><a href="#associatedtype.Target" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" class="associatedtype">Target</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a></h4></div></summary><div class='docblock'><p>The resulting type after dereferencing.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.deref" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#371-373" title="goto source code">source</a></div><a href="#method.deref" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#tymethod.deref" class="fnname">deref</a>(&self) -> &<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a></h4></div></summary><div class='docblock'><p>Dereferences the value.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Drop" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#362-366" title="goto source code">source</a></div><a href="#impl-Drop" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.drop" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#363-365" title="goto source code">source</a></div><a href="#method.drop" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop" class="fnname">drop</a>(&mut self)</h4></div></summary><div class='docblock'><p>Executes the destructor for this type. <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CPathPersistError%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#115-120" title="goto source code">source</a></div><a href="#impl-From%3CPathPersistError%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.PathPersistError.html" title="struct tempfile::PathPersistError">PathPersistError</a>> for <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/tempfile/file/mod.rs.html#117-119" title="goto source code">source</a></div><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(error: <a class="struct" href="struct.PathPersistError.html" title="struct tempfile::PathPersistError">PathPersistError</a>) -> <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><div id="impl-RefUnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-RefUnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div><div id="impl-Send" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Send" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div><div id="impl-Sync" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Sync" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div><div id="impl-Unpin" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Unpin" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div><div id="impl-UnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-UnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.TempPath.html" title="struct tempfile::TempPath">TempPath</a></h3></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Any" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132-136" title="goto source code">source</a></div><a href="#impl-Any" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.type_id" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#133" title="goto source code">source</a></div><a href="#method.type_id" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></div></summary><div class='docblock'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Borrow%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#209-214" title="goto source code">source</a></div><a href="#impl-Borrow%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#211" title="goto source code">source</a></div><a href="#method.borrow" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</h4></div></summary><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-BorrowMut%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#218-222" title="goto source code">source</a></div><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow_mut" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#219" title="goto source code">source</a></div><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</h4></div></summary><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546-550" title="goto source code">source</a></div><a href="#impl-From%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#547" title="goto source code">source</a></div><a href="#method.from-1" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Into%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">source</a></div><a href="#impl-Into%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">source</a></div><a href="#method.into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryFrom%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#584-593" title="goto source code">source</a></div><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error" class="type trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#590" title="goto source code">source</a></div><a href="#method.try_from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryInto%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#570-579" title="goto source code">source</a></div><a href="#impl-TryInto%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error-1" class="type trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#576" title="goto source code">source</a></div><a href="#method.try_into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-VZip%3CV%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/ppv_lite86/types.rs.html#224-232" title="goto source code">source</a></div><a href="#impl-VZip%3CV%3E" class="anchor"></a><h3 class="code-header in-band">impl<V, T> <a class="trait" href="../ppv_lite86/types/trait.VZip.html" title="trait ppv_lite86::types::VZip">VZip</a><V> for T <span class="where fmt-newline">where<br> V: <a class="trait" href="../ppv_lite86/types/trait.MultiLane.html" title="trait ppv_lite86::types::MultiLane">MultiLane</a><T>, </span></h3></div></summary><div class="impl-items"><div id="method.vzip" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/ppv_lite86/types.rs.html#229" title="goto source code">source</a></div><a href="#method.vzip" class="anchor"></a><h4 class="code-header">pub fn <a href="../ppv_lite86/types/trait.VZip.html#tymethod.vzip" class="fnname">vzip</a>(self) -> V</h4></div></div></details></div></section><section id="search" class="content hidden"></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="tempfile" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.60.0-nightly (1bd4fdc94 2022-01-12)" ></div>
|
||
</body></html> |