[−][src]Struct nix::dir::Dir
An open directory.
This is a lower-level interface than std::fs::ReadDir
. Notable differences:
- can be opened from a file descriptor (as returned by
openat
, perhaps before knowing if the path represents a file or directory). - implements
AsRawFd
, so it can be passed tofstat
,openat
, etc. The file descriptor continues to be owned by theDir
, so callers must not keep aRawFd
after theDir
is dropped. - can be iterated through multiple times without closing and reopening the file descriptor. Each iteration rewinds when finished.
- returns entries for
.
(current directory) and..
(parent directory). - returns entries' names as a
CStr
(no allocation or conversion beyond whatever libc does).
Methods
impl Dir
[src]
pub fn open<P: ?Sized + NixPath>(
path: &P,
oflag: OFlag,
mode: Mode
) -> Result<Self>
[src]
path: &P,
oflag: OFlag,
mode: Mode
) -> Result<Self>
Opens the given path as with fcntl::open
.
pub fn openat<P: ?Sized + NixPath>(
dirfd: RawFd,
path: &P,
oflag: OFlag,
mode: Mode
) -> Result<Self>
[src]
dirfd: RawFd,
path: &P,
oflag: OFlag,
mode: Mode
) -> Result<Self>
Opens the given path as with fcntl::openat
.
pub fn from<F: IntoRawFd>(fd: F) -> Result<Self>
[src]
Converts from a descriptor-based object, closing the descriptor on success or failure.
pub fn from_fd(fd: RawFd) -> Result<Self>
[src]
Converts from a file descriptor, closing it on success or failure.
ⓘImportant traits for Iter<'d>pub fn iter(&mut self) -> Iter
[src]
ⓘImportant traits for Iter<'d>
Returns an iterator of Result<Entry>
which rewinds when finished.
Trait Implementations
impl Send for Dir
[src]
impl Drop for Dir
[src]
impl Clone for Dir
[src]
impl Eq for Dir
[src]
impl PartialEq<Dir> for Dir
[src]
impl Debug for Dir
[src]
impl Hash for Dir
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl StructuralPartialEq for Dir
[src]
impl StructuralEq for Dir
[src]
impl AsRawFd for Dir
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,