Skip to content

Commit

Permalink
Add "inline" annotation to ReadChunkIntoIter
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Dec 2, 2023
1 parent 5cf83ea commit 73729ef
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ impl<'a, T> Drop for ReadChunkIntoIter<'a, T> {
impl<'a, T> Iterator for ReadChunkIntoIter<'a, T> {
type Item = T;

#[inline]
fn next(&mut self) -> Option<Self::Item> {
let ptr = if self.iterated < self.chunk.first_len {
unsafe { self.chunk.first_ptr.add(self.iterated) }
Expand All @@ -814,6 +815,7 @@ impl<'a, T> Iterator for ReadChunkIntoIter<'a, T> {
Some(unsafe { ptr.read() })
}

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let remaining = self.chunk.first_len + self.chunk.second_len - self.iterated;
(remaining, Some(remaining))
Expand Down

0 comments on commit 73729ef

Please sign in to comment.