Skip to content

Commit 8aa512d

Browse files
committed
Override count, nth and last for sys::unix::os::Env
Will allow optimised usage of `count` now and `nth` & `last` if `IntoIter` ever gets them in the future.
1 parent 16635f9 commit 8aa512d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libstd/sys/unix/os.rs

+5
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,11 @@ impl Iterator for Env {
407407
type Item = (OsString, OsString);
408408
fn next(&mut self) -> Option<(OsString, OsString)> { self.iter.next() }
409409
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
410+
fn count(self) -> usize { self.iter.count() }
411+
fn nth(&mut self, n: usize) -> Option<(OsString, OsString)> {
412+
self.iter.nth(n)
413+
}
414+
fn last(self) -> Option<(OsString, OsString)> { self.iter.last() }
410415
}
411416

412417
#[cfg(target_os = "macos")]

0 commit comments

Comments
 (0)