mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-09 14:25:24 +00:00
auto merge of #8842 : jfager/rust/remove-iter-module, r=pnkfelix
Moves the Times trait to num while the question of whether it should exist at all gets hashed out as a completely separate question.
This commit is contained in:
commit
a6835dd3cb
@ -1,26 +0,0 @@
|
||||
// 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 cmp::{Eq, ApproxEq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Great
|
||||
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 @@ mod test {
|
||||
#[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 borrow;
|
||||
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;
|
||||
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};
|
||||
|
Loading…
Reference in New Issue
Block a user