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 Feb 7, 2022
1 parent 16ceae3 commit 378530d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dir.rs
Expand Up @@ -142,6 +142,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 378530d

Please sign in to comment.