You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnnext(refself:T) -> Option<Self::Item>;fnadvance_by<+Destruct<T>, +Destruct<Self::Item>>(refself:T,n:usize,) -> Result<(),NonZero<usize>,>{letmut n = n;letmut res = Result::Ok(());whileletOption::Some(nz_n) = n.try_into(){ifletOption::Some(_) = Self::next(ref self){
n -= 1;}else{
res = Result::Err(nz_n);break;}};
res
}}
Implementing this should work in theory, but in practice, the following test fails to compile because:
#[test]fntest_advance_by(){letmut iter = array![1_u8,2,3,4].into_iter();assert_eq!(iter.advance_by(2),Result::Ok(()));assert_eq!(iter.next(),Option::Some(3));assert_eq!(iter.advance_by(0),Result::Ok(()));assert_eq!(iter.advance_by(100),Result::Err(99));}
error: Trait has no implementation in context: core::traits::Destruct::<Iterator::Item>.
--> corelib/src/test/iter_test.cairo:5:21
assert_eq!(iter.advance_by(2), Result::Ok(()));
The text was updated successfully, but these errors were encountered:
Bug Report
Cairo version:
6837d54
Current behavior:
Implementing this should work in theory, but in practice, the following test fails to compile because:
The text was updated successfully, but these errors were encountered: