Skip to content

Commit

Permalink
Impl AsRawFd for OwningIter
Browse files Browse the repository at this point in the history
For issue #1558
  • Loading branch information
deantvv committed Oct 16, 2021
1 parent da49e4f commit 89d6f9e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dir.rs
Expand Up @@ -141,6 +141,14 @@ impl Iterator for OwningIter {
}
}

/// The file descriptor continues to be owned by the `OwningIter`,
/// so callers must not keep a `RawFd` after the `OwningIter` is dropped.
impl AsRawFd for OwningIter {
fn as_raw_fd(&self) -> RawFd {
self.0.as_raw_fd()
}
}

impl IntoIterator for Dir {
type Item = Result<Entry>;
type IntoIter = OwningIter;
Expand Down

0 comments on commit 89d6f9e

Please sign in to comment.