Skip to main content

UnixDirHandle

Struct UnixDirHandle 

Source
pub struct UnixDirHandle(/* private fields */);

Trait Implementations§

Source§

impl DirHandle for UnixDirHandle

Source§

type Attrs = u32

The full st_mode, so an atomic replace does not silently drop the executable bit off every script it edits.

Source§

fn open_root(path: &Path) -> Result<Self, GuardIo>

Open the guard root itself, by name. The root is ours, not the model’s — this is the only place a full path enters, and it is the anchor every other method is relative to.
Source§

fn open_child_dir(&self, name: &OsStr) -> Result<Self, GuardIo>

Open a child directory without following any link at the final component. Unix O_NOFOLLOW|O_DIRECTORY; Windows FILE_OPEN_REPARSE_POINT|FILE_DIRECTORY_FILE relative to the handle.
Source§

fn make_child_dir(&self, name: &OsStr) -> Result<(), GuardIo>

mkdirat. Succeeding when it already exists is the caller’s business, not this method’s.
Source§

fn open_child_file(&self, name: &OsStr, mode: OpenMode) -> Result<File, GuardIo>

Source§

fn create_child_file(&self, name: &OsStr, excl: Excl) -> Result<File, GuardIo>

Source§

fn rename_child(&self, from: &OsStr, to: &OsStr) -> Result<(), GuardIo>

Best-effort removal of our own temp file. A failure here has nothing to report, which is why it returns nothing.
Source§

fn child_kind(&self, name: &OsStr) -> Option<NodeKind>

Classify a child without following it, or None if it does not exist. See NodeKind — the fail-closed default is the whole point.
Source§

fn child_attrs(&self, name: &OsStr) -> Option<Self::Attrs>

Source§

fn apply_attrs(&self, file: &File, attrs: Self::Attrs) -> Result<()>

Source§

fn identity(&self) -> Result<NodeId, GuardIo>

Stable identity, for the belt-and-braces check that the handle we validated and the path we return are the same object.
Source§

fn resolve_beneath( &self, rel: &Path, mode: OpenMode, ) -> Result<Option<File>, GuardIo>

Single-syscall beneath-resolution where the OS has one: Linux openat2 with RESOLVE_BENEATH|RESOLVE_NO_SYMLINKS|RESOLVE_NO_MAGICLINKS, Windows NtCreateFile with OBJ_DONT_REPARSE. Read more
Source§

fn into_file(self) -> File

Hand back the handle for this directory itself, for the one case where the caller’s target is the directory it already descended to. Widens nothing: it returns the object the caller already holds.
Source§

fn sync_name_durability(&self) -> Result<(), GuardIo>

After this returns, the most recent rename in this directory survives a crash. Read more
Source§

impl Sealed for UnixDirHandle

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.