pub struct UnixDirHandle(/* private fields */);Trait Implementations§
Source§impl DirHandle for UnixDirHandle
impl DirHandle for UnixDirHandle
Source§type Attrs = u32
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>
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>
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>
fn make_child_dir(&self, name: &OsStr) -> Result<(), GuardIo>
mkdirat. Succeeding when it already exists is the caller’s business,
not this method’s.fn open_child_file(&self, name: &OsStr, mode: OpenMode) -> Result<File, GuardIo>
fn create_child_file(&self, name: &OsStr, excl: Excl) -> Result<File, GuardIo>
fn rename_child(&self, from: &OsStr, to: &OsStr) -> Result<(), GuardIo>
Source§fn unlink_child(&self, name: &OsStr)
fn unlink_child(&self, name: &OsStr)
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>
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.fn child_attrs(&self, name: &OsStr) -> Option<Self::Attrs>
fn apply_attrs(&self, file: &File, attrs: Self::Attrs) -> Result<()>
Source§fn identity(&self) -> Result<NodeId, GuardIo>
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>
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 moreimpl Sealed for UnixDirHandle
Auto Trait Implementations§
impl Freeze for UnixDirHandle
impl RefUnwindSafe for UnixDirHandle
impl Send for UnixDirHandle
impl Sync for UnixDirHandle
impl Unpin for UnixDirHandle
impl UnsafeUnpin for UnixDirHandle
impl UnwindSafe for UnixDirHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more