summaryrefslogtreecommitdiff
path: root/src/dir.rs
diff options
context:
space:
mode:
authorDean Li <deantvv@gmail.com>2021-10-16 12:33:50 +0800
committerDean Li <deantvv@gmail.com>2022-02-07 21:39:29 +0800
commit378530d6159a6732053ae02585df7ac5a8961c37 (patch)
tree96404e4af5499f7b812f6570899c673da592c92f /src/dir.rs
parent16ceae331c0a3e53b75a841aae1d7927c3d474c6 (diff)
downloadnix-378530d6159a6732053ae02585df7ac5a8961c37.zip
Impl `AsRawFd` for `OwningIter`
For issue #1558
Diffstat (limited to 'src/dir.rs')
-rw-r--r--src/dir.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/dir.rs b/src/dir.rs
index 62e7b4d5..396b54fb 100644
--- a/src/dir.rs
+++ b/src/dir.rs
@@ -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;