[−][src]Function fungus::sys::user::temp_dir
pub fn temp_dir<T: AsRef<str>>(prefix: T) -> FuResult<PathBuf>
Returns the full path to a newly created directory in /tmp
that can be used for temporary
work. The returned path will be checked for uniqueness and created with a random suffix and
the given prefix
. It is up to the calling code to ensure the directory returned is
properly cleaned up when done with.
Examples
use fungus::prelude::*; let tmpdir = user::temp_dir("foo").unwrap(); assert_eq!(tmpdir.exists(), true); { let _defer = defer(|| sys::remove_all(&tmpdir).unwrap()); } assert_eq!(tmpdir.exists(), false);