Skip to main content

RetainedRegularFileIdentity

Struct RetainedRegularFileIdentity 

Source
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

Source

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.

Source

pub fn identity(&self) -> &RegularFileFilesystemIdentity

Return the identity captured from the retained handle.

Source

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.

Trait Implementations§

Source§

impl Debug for RetainedRegularFileIdentity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.