tempfile_ext

Trait NamedTempFileExt

Source
pub trait NamedTempFileExt {
    // Required method
    fn persist_if_changed<P: AsRef<Path>>(
        self,
        path: P,
    ) -> Result<File, PersistError>;
}

Required Methods§

Source

fn persist_if_changed<P: AsRef<Path>>( self, path: P, ) -> Result<File, PersistError>

Atomically overwrite the target path if the contents are different.

This is conceptually similar to tempfile::NamedTempFile::persist, but will only overwrite the target path if:

  • The target path does not exist.
  • The target path has different contents than self.

It will not overwrite the target path if it already exists and has the same content.

Either way, it will return an opened File for the target path.

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.

Implementations on Foreign Types§

Source§

impl NamedTempFileExt for NamedTempFile

Implementors§