Skip to content

Commit

Permalink
Merge pull request #29 from coolreader18/patch-2
Browse files Browse the repository at this point in the history
Optimize Iterator::nth for the Enum* iterators
  • Loading branch information
gentoo90 committed Feb 26, 2020
2 parents c5a6559 + c9a653b commit 067f0ef
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,11 @@ impl<'key> Iterator for EnumKeys<'key> {
e @ None => e,
}
}

fn nth(&mut self, n: usize) -> Option<Self::Item> {
self.index += n as DWORD;
self.next()
}
}

/// Iterator over values
Expand All @@ -1051,6 +1056,11 @@ impl<'key> Iterator for EnumValues<'key> {
e @ None => e,
}
}

fn nth(&mut self, n: usize) -> Option<Self::Item> {
self.index += n as DWORD;
self.next()
}
}

fn to_utf16<P: AsRef<OsStr>>(s: P) -> Vec<u16> {
Expand Down

0 comments on commit 067f0ef

Please sign in to comment.