Skip to content

Commit

Permalink
feat: implement ExactSizeIterator for ParamsIter
Browse files Browse the repository at this point in the history
  • Loading branch information
Totodore authored Jun 30, 2024
1 parent 5a78b63 commit ebc2563
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@ impl<'ps, 'k, 'v> Iterator for ParamsIter<'ps, 'k, 'v> {
}
}
}
impl ExactSizeIterator for ParamsIter<'_, '_, '_> {
fn len(&self) -> usize {
match self.kind {
ParamsIterKind::None => 0,
ParamsIterKind::Small(ref iter) => iter.len(),
ParamsIterKind::Large(ref iter) => iter.len(),
}
}
}

#[cfg(test)]
mod tests {
Expand Down

0 comments on commit ebc2563

Please sign in to comment.