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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl NamedTempFileExt for NamedTempFile

Implementors§