core: Inherit the iter module

This commit is contained in:
Alex Crichton 2014-04-30 21:41:03 -07:00
parent 06fcb6b1c8
commit b024ba544c
4 changed files with 17 additions and 2 deletions

View File

@ -969,7 +969,7 @@ impl<A: TotalOrd, T: Iterator<A>> OrdIterator<A> for T {
}
/// `MinMaxResult` is an enum returned by `min_max`. See `OrdIterator::min_max` for more detail.
#[deriving(Clone, Eq, Show)]
#[deriving(Clone, Eq)]
pub enum MinMaxResult<T> {
/// Empty iterator
NoElements,

View File

@ -43,6 +43,7 @@ mod unit;
pub mod any;
pub mod bool;
pub mod finally;
pub mod iter;
pub mod option;
pub mod raw;
pub mod char;

View File

@ -489,6 +489,7 @@ use char::Char;
use container::Container;
use io::MemWriter;
use io;
use iter;
use iter::{Iterator, range};
use num::Signed;
use option::{Option,Some,None};
@ -1301,5 +1302,18 @@ impl Show for TypeId {
}
}
impl<T: Show> Show for iter::MinMaxResult<T> {
fn fmt(&self, f: &mut Formatter) -> Result {
match *self {
iter::NoElements =>
write!(f.buf, "NoElements"),
iter::OneElement(ref t) =>
write!(f.buf, "OneElement({})", *t),
iter::MinMax(ref t1, ref t2) =>
write!(f.buf, "MinMax({}, {})", *t1, *t2),
}
}
}
// If you expected tests to be here, look instead at the run-pass/ifmt.rs test,
// it's a lot easier than creating all of the rt::Piece structures here.

View File

@ -145,6 +145,7 @@ pub use core::clone;
pub use core::container;
pub use core::default;
pub use core::intrinsics;
pub use core::iter;
pub use core::mem;
pub use core::option;
pub use core::ptr;
@ -217,7 +218,6 @@ pub mod gc;
pub mod from_str;
pub mod num;
pub mod iter;
pub mod to_str;
pub mod hash;