Skip to content

Commit

Permalink
fix: VecIter using bounded RangeIter
Browse files Browse the repository at this point in the history
  • Loading branch information
julio4 committed Jan 15, 2025
1 parent 12d7113 commit 3bd1ff9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion corelib/src/iter.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,4 @@
//! [`map`]: Iterator::map
mod adapters;
mod traits;
pub use traits::{IntoIterator, Iterator};
pub use traits::{FromIterator, IntoIterator, Iterator};
10 changes: 6 additions & 4 deletions corelib/src/starknet/storage/vec.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ pub impl VecIntoIterRange<
}
#[inline]
fn into_iter_full_range(self: StoragePath<Vec<T>>) -> Self::IntoIter {
VecIter { current_index: (0..VecTraitImpl::len(self)).into_iter(), vec: self }
VecIter { current_index: (0..core::num::traits::Bounded::MAX).into_iter(), vec: self }
}
}

Expand All @@ -442,7 +442,7 @@ pub impl PathableVecIntoIterRange<
#[inline]
fn into_iter_full_range(self: T) -> Self::IntoIter {
let vec = self.as_path();
VecIter { current_index: (0..vec.len()).into_iter(), vec }
VecIter { current_index: (0..core::num::traits::Bounded::MAX).into_iter(), vec }
}
}

Expand Down Expand Up @@ -473,7 +473,9 @@ pub impl MutableVecIntoIterRange<
}
#[inline]
fn into_iter_full_range(self: StoragePath<Mutable<Vec<T>>>) -> Self::IntoIter {
MutableVecIter { current_index: (0..MutVecTraitImpl::len(self)).into_iter(), vec: self }
MutableVecIter {
current_index: (0..core::num::traits::Bounded::MAX).into_iter(), vec: self,
}
}
}

Expand All @@ -493,6 +495,6 @@ pub impl PathableMutableVecIntoIterRange<
#[inline]
fn into_iter_full_range(self: T) -> Self::IntoIter {
let vec = self.as_path();
MutableVecIter { current_index: (0..vec.len()).into_iter(), vec }
MutableVecIter { current_index: (0..core::num::traits::Bounded::MAX).into_iter(), vec }
}
}

0 comments on commit 3bd1ff9

Please sign in to comment.