Skip to content

Commit 0244b83

Browse files
bors[bot]deantvv
andauthored
Merge #1563
1563: Impl `AsRawFd` for `OwningIter` r=rtzoeller a=deantvv For issue #1558 Co-authored-by: Dean Li <[email protected]>
2 parents 16ceae3 + 08e40c0 commit 0244b83

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
4141
(#[1640](https://github.com/nix-rust/nix/pull/1640))
4242
- Added `accept4` on DragonFly, Emscripten, Fuchsia, Illumos, and NetBSD.
4343
(#[1654](https://github.com/nix-rust/nix/pull/1654))
44+
- Added `AsRawFd` implementation on `OwningIter`.
45+
(#[1563](https://github.com/nix-rust/nix/pull/1563))
4446

4547
### Changed
4648

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)