Skip to main content

TempFilePath

Trait TempFilePath 

Source
pub trait TempFilePath {
    // Required methods
    fn temp_filename(&self, ext: &str) -> String;
    fn temp_file_path<P: AsRef<Path>>(
        &self,
        folder_name: Option<P>,
        ext: &str,
    ) -> PathBuf;
}
Expand description

Get a temporary file path for an object

Required Methods§

Source

fn temp_filename(&self, ext: &str) -> String

Get a suitable temporary filename for a hashable object; this filename should be based on the hash and consistent across multiple calls, so that later callers can use the function to reconstruct an already-created filename. Note that the output is a string, not a PathBuf, since we can guarantee that the filename will be valid unicode.

Source

fn temp_file_path<P: AsRef<Path>>( &self, folder_name: Option<P>, ext: &str, ) -> PathBuf

Generate a temporary filepath for an object, giving it the extension ext. This should join the result of temp_filename to a consistent temporary directory which is guaranteed to be either the result of std::env::temp_dir or (if folder_name is not None) a subdirectory called folder_name.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> TempFilePath for T
where T: HashToString,