pub trait SharedFileLockNameBuilder {
// Required method
fn create_lock_file_name(&self, file_name: &OsStr) -> OsString;
// Provided methods
fn create_lock_file_path(&self, file: &Path) -> Result<OsString> { ... }
fn get_lock_directory<'a>(&self, file: &'a Path) -> Option<&'a Path> { ... }
}
Required Methods§
Sourcefn create_lock_file_name(&self, file_name: &OsStr) -> OsString
fn create_lock_file_name(&self, file_name: &OsStr) -> OsString
Creates the lock file name based on the original file name. It is used by
Self::create_lock_file_path()
to compose the lock file name.
Arguments:
file_name
: The name of the file that will be protected;
Returns the name of the lock file.
Provided Methods§
Sourcefn create_lock_file_path(&self, file: &Path) -> Result<OsString>
fn create_lock_file_path(&self, file: &Path) -> Result<OsString>
Creates the lock file name from the target file.
Arguments:
file
: The path to the target file;
Returns:
Ok(x)
: The lock file path;Err(e)
: If the lock file name cannot be created from the specified path;
Sourcefn get_lock_directory<'a>(&self, file: &'a Path) -> Option<&'a Path>
fn get_lock_directory<'a>(&self, file: &'a Path) -> Option<&'a Path>
Returns the lock directory. It is used by Self::create_lock_file_path()
to
compose the lock file name.
By default it is the same directory of the protected file.
Arguments:
file
: The path to the protected file.
Returns:
Some(x)
: The parent path;None
: If the parent path is not present or is not available;