pub struct RetainedRegularFileIdentity { /* private fields */ }Expand description
Retained identity guard for one exact single-link regular file.
On Windows the retained handle denies write and delete sharing, so the named file cannot be
modified, renamed, or replaced while the guard is live. On Unix the descriptor retains the
exact object but cannot prevent namespace rebinding; callers must use Self::verify_path
immediately before and after sensitive pathname work and must not claim moment-wide binding.
Implementations§
Source§impl RetainedRegularFileIdentity
impl RetainedRegularFileIdentity
Sourcepub fn open(path: &Path) -> Result<Self, DirectoryIdentityError>
pub fn open(path: &Path) -> Result<Self, DirectoryIdentityError>
Open and retain the exact plain single-link regular file currently named by an absolute path.
§Errors
Returns a typed error when the path is not absolute, the final object is a symbolic link or reparse point, the file has multiple links, or a stable filesystem identity is unavailable.
Sourcepub fn identity(&self) -> &RegularFileFilesystemIdentity
pub fn identity(&self) -> &RegularFileFilesystemIdentity
Return the identity captured from the retained handle.
Sourcepub fn verify_path(&self, path: &Path) -> Result<(), DirectoryIdentityError>
pub fn verify_path(&self, path: &Path) -> Result<(), DirectoryIdentityError>
Require the path to still name the exact retained file.
§Errors
Returns a typed capture error, or DirectoryIdentityErrorKind::IdentityMismatch when the
path no longer names the retained exact file.