<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `TempDir` struct in crate `tempdir`.">
<meta name="keywords" content="rust, rustlang, rust-lang, TempDir">
<title>tempdir::TempDir - Rust</title>
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../main.css">
<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<a href='../tempdir/index.html'><img src='http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='' width='100'></a>
<p class='location'><a href='index.html'>tempdir</a></p><script>window.sidebarCurrent = {name: 'TempDir', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content struct">
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>tempdir</a>::<wbr><a class='struct' href=''>TempDir</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>−</span>]
</a>
</span><a id='src-10' class='srclink' href='../src/tempdir/lib.rs.html#26-28' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct TempDir {
// some fields omitted
}</pre><div class='docblock'><p>A wrapper for a path to temporary directory implementing automatic
scope-based deletion.</p>
</div><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl <a class='struct' href='../tempdir/struct.TempDir.html' title='tempdir::TempDir'>TempDir</a></code></h3><div class='impl-items'><h4 id='method.new_in' class='method'><code>fn <a href='#method.new_in' class='fnname'>new_in</a><P: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a><<a class='struct' href='https://doc.rust-lang.org/nightly/std/path/struct.Path.html' title='std::path::Path'>Path</a>>>(tmpdir: P, prefix: &<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='type' href='https://doc.rust-lang.org/nightly/std/io/error/type.Result.html' title='std::io::error::Result'>Result</a><<a class='struct' href='../tempdir/struct.TempDir.html' title='tempdir::TempDir'>TempDir</a>></code></h4>
<div class='docblock'><p>Attempts to make a temporary directory inside of <code>tmpdir</code> whose name
will have the prefix <code>prefix</code>. The directory will be automatically
deleted once the returned wrapper is destroyed.</p>
<p>If no directory can be created, <code>Err</code> is returned.</p>
</div><h4 id='method.new' class='method'><code>fn <a href='#method.new' class='fnname'>new</a>(prefix: &<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='type' href='https://doc.rust-lang.org/nightly/std/io/error/type.Result.html' title='std::io::error::Result'>Result</a><<a class='struct' href='../tempdir/struct.TempDir.html' title='tempdir::TempDir'>TempDir</a>></code></h4>
<div class='docblock'><p>Attempts to make a temporary directory inside of <code>env::temp_dir()</code> whose
name will have the prefix <code>prefix</code>. The directory will be automatically
deleted once the returned wrapper is destroyed.</p>
<p>If no directory can be created, <code>Err</code> is returned.</p>
</div><h4 id='method.into_path' class='method'><code>fn <a href='#method.into_path' class='fnname'>into_path</a>(self) -> <a class='struct' href='https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html' title='std::path::PathBuf'>PathBuf</a></code></h4>
<div class='docblock'><p>Unwrap the wrapped <code>std::path::Path</code> from the <code>TempDir</code> wrapper.
This discards the wrapper so that the automatic deletion of the
temporary directory is prevented.</p>
</div><h4 id='method.path' class='method'><code>fn <a href='#method.path' class='fnname'>path</a>(&self) -> &<a class='struct' href='https://doc.rust-lang.org/nightly/std/path/struct.Path.html' title='std::path::Path'>Path</a></code></h4>
<div class='docblock'><p>Access the wrapped <code>std::path::Path</code> to the temporary directory.</p>
</div><h4 id='method.close' class='method'><code>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='std::io::error::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>></code></h4>
<div class='docblock'><p>Close and remove the temporary directory</p>
<p>Although <code>TempDir</code> removes the directory on drop, in the destructor
any errors are ignored. To detect errors cleaning up the temporary
directory, call <code>close</code> instead.</p>
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Drop.html' title='core::ops::Drop'>Drop</a> for <a class='struct' href='../tempdir/struct.TempDir.html' title='tempdir::TempDir'>TempDir</a></code></h3><div class='impl-items'><h4 id='method.drop' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Drop.html#method.drop' class='fnname'>drop</a>(&mut self)</code></h4>
</div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../";
window.currentCrate = "tempdir";
window.playgroundUrl = "";
</script>
<script src="../jquery.js"></script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>