diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-04-17 15:32:42 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-04-21 11:37:43 -0700 |
| commit | eeb94886adccb3f13003f92f117115d17846ce1f (patch) | |
| tree | 2d729b8e48c5022941e2c06e412a2b2a1744ca1c /src/libcore/iter.rs | |
| parent | e091ba3f3e8b2b00827ab4934314829b33ffb966 (diff) | |
| download | rust-eeb94886adccb3f13003f92f117115d17846ce1f.tar.gz rust-eeb94886adccb3f13003f92f117115d17846ce1f.zip | |
std: Remove deprecated/unstable num functionality
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
Diffstat (limited to 'src/libcore/iter.rs')
| -rw-r--r-- | src/libcore/iter.rs | 76 |
1 files changed, 1 insertions, 75 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 24ef8a6e01a..651658e4d56 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -64,7 +64,7 @@ use cmp::{Ord, PartialOrd, PartialEq}; use default::Default; use marker; use mem; -use num::{Int, Zero, One}; +use num::{Zero, One}; use ops::{self, Add, Sub, FnMut, Mul, RangeFrom}; use option::Option::{self, Some, None}; use marker::Sized; @@ -2647,80 +2647,6 @@ impl<A: Step + Zero + Clone> Iterator for StepBy<A, ops::Range<A>> { } } -/// An iterator over the range [start, stop] by `step`. It handles overflow by stopping. -#[derive(Clone)] -#[unstable(feature = "core", - reason = "likely to be replaced by range notation and adapters")] -pub struct RangeStepInclusive<A> { - state: A, - stop: A, - step: A, - rev: bool, - done: bool, -} - -/// Returns an iterator over the range [start, stop] by `step`. -/// -/// It handles overflow by stopping. -/// -/// # Examples -/// -/// ``` -/// # #![feature(core)] -/// use std::iter::range_step_inclusive; -/// -/// for i in range_step_inclusive(0, 10, 2) { -/// println!("{}", i); -/// } -/// ``` -/// -/// This prints: -/// -/// ```text -/// 0 -/// 2 -/// 4 -/// 6 -/// 8 -/// 10 -/// ``` -#[inline] -#[unstable(feature = "core", - reason = "likely to be replaced by range notation and adapters")] -#[allow(deprecated)] -pub fn range_step_inclusive<A: Int>(start: A, stop: A, step: A) -> RangeStepInclusive<A> { - let rev = step < Int::zero(); - RangeStepInclusive { - state: start, - stop: stop, - step: step, - rev: rev, - done: false, - } -} - -#[unstable(feature = "core", - reason = "likely to be replaced by range notation and adapters")] -#[allow(deprecated)] -impl<A: Int> Iterator for RangeStepInclusive<A> { - type Item = A; - - #[inline] - fn next(&mut self) -> Option<A> { - if !self.done && ((self.rev && self.state >= self.stop) || - (!self.rev && self.state <= self.stop)) { - let result = self.state; - match self.state.checked_add(self.step) { - Some(x) => self.state = x, - None => self.done = true - } - Some(result) - } else { - None - } - } -} - macro_rules! range_exact_iter_impl { ($($t:ty)*) => ($( #[stable(feature = "rust1", since = "1.0.0")] |
