Skip to content

Commit 378530d

Browse files
committed
Impl AsRawFd for OwningIter
For issue #1558
1 parent 16ceae3 commit 378530d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/dir.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ impl Iterator for OwningIter {
142142
}
143143
}
144144

145+
/// The file descriptor continues to be owned by the `OwningIter`,
146+
/// so callers must not keep a `RawFd` after the `OwningIter` is dropped.
147+
impl AsRawFd for OwningIter {
148+
fn as_raw_fd(&self) -> RawFd {
149+
self.0.as_raw_fd()
150+
}
151+
}
152+
145153
impl IntoIterator for Dir {
146154
type Item = Result<Entry>;
147155
type IntoIter = OwningIter;

0 commit comments

Comments
 (0)