Skip to content

Commit

Permalink
Add cfg to IndexVecIter, IndexVecIntoIter
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Sep 6, 2024
1 parent 415be56 commit a64adc3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/seq/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ impl From<Vec<u64>> for IndexVec {
pub enum IndexVecIter<'a> {
#[doc(hidden)]
U32(slice::Iter<'a, u32>),
#[cfg(target_pointer_width = "64")]
#[doc(hidden)]
U64(slice::Iter<'a, u64>),
}
Expand All @@ -160,6 +161,7 @@ impl<'a> Iterator for IndexVecIter<'a> {
use self::IndexVecIter::*;
match self {
U32(iter) => iter.next().map(|i| *i as usize),
#[cfg(target_pointer_width = "64")]
U64(iter) => iter.next().map(|i| *i as usize),
}
}
Expand All @@ -168,6 +170,7 @@ impl<'a> Iterator for IndexVecIter<'a> {
fn size_hint(&self) -> (usize, Option<usize>) {
match self {
IndexVecIter::U32(v) => v.size_hint(),
#[cfg(target_pointer_width = "64")]
IndexVecIter::U64(v) => v.size_hint(),
}
}
Expand All @@ -180,6 +183,7 @@ impl<'a> ExactSizeIterator for IndexVecIter<'a> {}
pub enum IndexVecIntoIter {
#[doc(hidden)]
U32(vec::IntoIter<u32>),
#[cfg(target_pointer_width = "64")]
#[doc(hidden)]
U64(vec::IntoIter<u64>),
}
Expand All @@ -192,6 +196,7 @@ impl Iterator for IndexVecIntoIter {
use self::IndexVecIntoIter::*;
match self {
U32(v) => v.next().map(|i| i as usize),
#[cfg(target_pointer_width = "64")]
U64(v) => v.next().map(|i| i as usize),
}
}
Expand All @@ -201,6 +206,7 @@ impl Iterator for IndexVecIntoIter {
use self::IndexVecIntoIter::*;
match self {
U32(v) => v.size_hint(),
#[cfg(target_pointer_width = "64")]
U64(v) => v.size_hint(),
}
}
Expand Down

0 comments on commit a64adc3

Please sign in to comment.