summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/dir.rs8
2 files changed, 10 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7433db13..82f89bb2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -41,6 +41,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
(#[1640](https://github.com/nix-rust/nix/pull/1640))
- Added `accept4` on DragonFly, Emscripten, Fuchsia, Illumos, and NetBSD.
(#[1654](https://github.com/nix-rust/nix/pull/1654))
+- Added `AsRawFd` implementation on `OwningIter`.
+ (#[1563](https://github.com/nix-rust/nix/pull/1563))
### Changed
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;