mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
085dff4944
stabilizes `core::range::RangeFrom` stabilizes `core::range::RangeFromIter` add examples for `remainder` method on range iterators `RangeFromIter::remainder` was not stabilized (see issue 154458)
22 lines
562 B
Rust
22 lines
562 B
Rust
//@ run-pass
|
|
//@ compile-flags: -C overflow-checks=yes
|
|
|
|
use std::{iter, range};
|
|
|
|
fn main() {
|
|
for (a, b) in iter::zip(0_u32..256, range::RangeFrom::from(0_u8..)) {
|
|
assert_eq!(a, u32::from(b));
|
|
}
|
|
|
|
let mut a = range::RangeFrom::from(0_u8..).into_iter();
|
|
let mut b = 0_u8..;
|
|
assert_eq!(a.next(), b.next());
|
|
assert_eq!(a.nth(5), b.nth(5));
|
|
assert_eq!(a.nth(0), b.next());
|
|
|
|
let mut a = range::RangeFrom::from(0_u8..).into_iter();
|
|
let mut b = 0_u8..;
|
|
assert_eq!(a.nth(5), b.nth(5));
|
|
assert_eq!(a.nth(0), b.next());
|
|
}
|