提交 dc30005a 编写于 作者: J Jason Fager

Remove the iter module.

Moves the Times trait to num while the question of whether it should
exist at all gets hashed out as a completely separate question.
上级 78c5f97a
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
/*! Times trait
~~~ {.rust}
use iter::Times;
let ten = 10 as uint;
let mut accum = 0;
do ten.times { accum += 1; }
~~~
*/
#[allow(missing_doc)]
pub trait Times {
fn times(&self, it: &fn());
}
......@@ -80,6 +80,19 @@ pub trait Signed: Num
pub trait Unsigned: Num {}
/// Times trait
///
/// ~~~ {.rust}
/// use num::Times;
/// let ten = 10 as uint;
/// let mut accum = 0;
/// do ten.times { accum += 1; }
/// ~~~
///
pub trait Times {
fn times(&self, it: &fn());
}
pub trait Integer: Num
+ Orderable
+ Div<Self,Self>
......
......@@ -10,7 +10,7 @@
//! Operations and constants for `uint`
use iter;
use num;
use sys;
pub use self::generated::*;
......@@ -70,7 +70,7 @@ pub fn div_round(x: uint, y: uint) -> uint {
///
pub fn div_floor(x: uint, y: uint) -> uint { return x / y; }
impl iter::Times for uint {
impl num::Times for uint {
#[inline]
///
/// A convenience form for basic repetition. Given a uint `x`,
......@@ -162,7 +162,7 @@ fn test_div() {
#[test]
pub fn test_times() {
use iter::Times;
use num::Times;
let ten = 10 as uint;
let mut accum = 0;
do ten.times { accum += 1; }
......
......@@ -49,7 +49,7 @@
pub use char::Char;
pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
pub use hash::Hash;
pub use iter::Times;
pub use num::Times;
pub use iterator::{FromIterator, Extendable};
pub use iterator::{Iterator, DoubleEndedIterator, RandomAccessIterator, ClonableIterator};
pub use iterator::{OrdIterator, MutableDoubleEndedIterator};
......
......@@ -718,7 +718,7 @@ mod test {
use option::*;
use rt::test::*;
use cell::Cell;
use iter::Times;
use num::Times;
use rt::util;
#[test]
......
......@@ -1114,7 +1114,7 @@ fn no_missed_messages() {
#[test]
fn multithreading() {
use rt::comm::*;
use iter::Times;
use num::Times;
use vec::OwnedVector;
use container::Container;
......
......@@ -126,7 +126,7 @@ pub fn select2<TA, A: SelectPort<TA>, TB, B: SelectPort<TB>>(mut a: A, mut b: B)
mod test {
use super::*;
use clone::Clone;
use iter::Times;
use num::Times;
use option::*;
use rt::comm::*;
use rt::test::*;
......
......@@ -140,7 +140,6 @@ pub mod linkhack {
pub mod from_str;
#[path = "num/num.rs"]
pub mod num;
pub mod iter;
pub mod iterator;
pub mod to_str;
pub mod to_bytes;
......@@ -220,4 +219,3 @@ mod std {
pub use fmt;
pub use to_bytes;
}
......@@ -21,7 +21,7 @@
use char::Char;
use clone::{Clone, DeepClone};
use container::{Container, Mutable};
use iter::Times;
use num::Times;
use iterator::{Iterator, FromIterator, Extendable};
use iterator::{Filter, AdditiveIterator, Map};
use iterator::{Invert, DoubleEndedIterator};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册