Skip to content
This repository was archived by the owner on Aug 20, 2021. It is now read-only.

Commit b460a2c

Browse files
committed
Merge pull request #9 from cybergeek94/patch-1
Add `Debug` impl to `TempDir`
2 parents cafb54f + 7874626 commit b460a2c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ extern crate rand;
1717

1818
use std::env;
1919
use std::io::{self, Error, ErrorKind};
20+
use std::fmt;
2021
use std::fs;
2122
use std::path::{self, PathBuf, Path};
2223
use rand::{thread_rng, Rng};
@@ -113,6 +114,14 @@ impl TempDir {
113114
}
114115
}
115116

117+
impl fmt::Debug for TempDir {
118+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
119+
f.debug_struct("TempDir")
120+
.field("path", &self.path())
121+
.finish()
122+
}
123+
}
124+
116125
impl Drop for TempDir {
117126
fn drop(&mut self) {
118127
let _ = self.cleanup_dir();

0 commit comments

Comments
 (0)