2013-01-17 23:28:42 -08:00
|
|
|
// Copyright 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.
|
|
|
|
|
2014-04-30 17:35:54 +02:00
|
|
|
//! The Rust prelude
|
2014-04-25 00:39:58 -07:00
|
|
|
//!
|
|
|
|
//! Because `std` is required by most serious Rust software, it is
|
|
|
|
//! imported at the topmost level of every crate by default, as if the
|
|
|
|
//! first line of each crate was
|
|
|
|
//!
|
|
|
|
//! ```ignore
|
|
|
|
//! extern crate std;
|
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//! This means that the contents of std can be accessed from any context
|
|
|
|
//! with the `std::` path prefix, as in `use std::vec`, `use std::task::spawn`,
|
|
|
|
//! etc.
|
|
|
|
//!
|
|
|
|
//! Additionally, `std` contains a `prelude` module that reexports many of the
|
|
|
|
//! most common traits, types and functions. The contents of the prelude are
|
|
|
|
//! imported into every *module* by default. Implicitly, all modules behave as if
|
|
|
|
//! they contained the following prologue:
|
|
|
|
//!
|
|
|
|
//! ```ignore
|
|
|
|
//! use std::prelude::*;
|
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//! The prelude is primarily concerned with exporting *traits* that are so
|
|
|
|
//! pervasive that it would be obnoxious to import for every use, particularly
|
|
|
|
//! those that define methods on primitive types. It does include a few
|
|
|
|
//! particularly useful standalone functions, like `from_str`, `range`, and
|
|
|
|
//! `drop`, `spawn`, and `channel`.
|
2013-06-02 20:46:12 -07:00
|
|
|
|
2013-05-24 19:35:29 -07:00
|
|
|
// Reexported core operators
|
2014-03-27 00:01:11 +01:00
|
|
|
pub use kinds::{Copy, Send, Sized, Share};
|
2013-05-01 15:40:05 +10:00
|
|
|
pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not};
|
2013-01-08 19:37:25 -08:00
|
|
|
pub use ops::{BitAnd, BitOr, BitXor};
|
2014-02-26 23:02:35 +02:00
|
|
|
pub use ops::{Drop, Deref, DerefMut};
|
2013-01-08 19:37:25 -08:00
|
|
|
pub use ops::{Shl, Shr, Index};
|
|
|
|
pub use option::{Option, Some, None};
|
|
|
|
pub use result::{Result, Ok, Err};
|
|
|
|
|
2013-05-24 19:35:29 -07:00
|
|
|
// Reexported functions
|
2013-09-05 00:48:48 -04:00
|
|
|
pub use from_str::from_str;
|
2013-10-21 21:41:32 +02:00
|
|
|
pub use iter::range;
|
2014-02-01 04:35:36 +08:00
|
|
|
pub use mem::drop;
|
2013-03-28 19:12:48 -07:00
|
|
|
|
2013-05-24 19:35:29 -07:00
|
|
|
// Reexported types and traits
|
2013-10-11 23:20:34 +02:00
|
|
|
|
2013-12-15 01:04:22 +11:00
|
|
|
pub use ascii::{Ascii, AsciiCast, OwnedAsciiCast, AsciiStr, IntoBytes};
|
2013-08-03 17:13:14 -07:00
|
|
|
pub use c_str::ToCStr;
|
2013-10-21 21:41:32 +02:00
|
|
|
pub use char::Char;
|
2014-03-05 01:19:14 -05:00
|
|
|
pub use clone::Clone;
|
2014-01-08 22:57:31 +11:00
|
|
|
pub use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater, Equiv};
|
2013-07-13 19:44:36 -07:00
|
|
|
pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
|
2013-09-08 11:01:16 -04:00
|
|
|
pub use iter::{FromIterator, Extendable};
|
2013-12-27 13:53:41 +02:00
|
|
|
pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator};
|
2013-09-08 11:01:16 -04:00
|
|
|
pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize};
|
2014-02-17 07:20:01 +11:00
|
|
|
pub use num::{Num, NumCast, CheckedAdd, CheckedSub, CheckedMul};
|
2014-04-18 12:48:48 +10:00
|
|
|
pub use num::{Signed, Unsigned};
|
2014-05-10 13:46:05 -07:00
|
|
|
pub use num::{Primitive, Int, Float, FloatMath, ToPrimitive, FromPrimitive};
|
2014-05-06 21:25:36 -07:00
|
|
|
pub use option::Expect;
|
2014-05-05 18:56:44 -07:00
|
|
|
pub use owned::Box;
|
2013-09-26 17:21:59 -07:00
|
|
|
pub use path::{GenericPath, Path, PosixPath, WindowsPath};
|
2013-06-03 13:50:29 -04:00
|
|
|
pub use ptr::RawPtr;
|
2013-11-13 11:17:58 -08:00
|
|
|
pub use io::{Buffer, Writer, Reader, Seek};
|
2014-02-07 16:36:59 -08:00
|
|
|
pub use str::{Str, StrVector, StrSlice, OwnedStr, IntoMaybeOwned};
|
2014-04-30 23:06:36 -07:00
|
|
|
pub use str::{StrAllocating};
|
2013-12-15 01:04:22 +11:00
|
|
|
pub use to_str::{ToStr, IntoStr};
|
2013-10-21 21:41:32 +02:00
|
|
|
pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
|
|
|
|
pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
|
|
|
|
pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
|
2014-05-20 12:12:44 -07:00
|
|
|
pub use slice::{CloneableVector, ImmutableCloneableVector, MutableCloneableVector};
|
|
|
|
pub use slice::{ImmutableVector, MutableVector};
|
|
|
|
pub use slice::{ImmutableEqVector, ImmutableTotalOrdVector, MutableTotalOrdVector};
|
|
|
|
pub use slice::{Vector, VectorVector, OwnedVector, MutableVectorAllocating};
|
2014-04-02 16:54:22 -07:00
|
|
|
pub use strbuf::StrBuf;
|
2014-03-19 14:21:12 -07:00
|
|
|
pub use vec::Vec;
|
2013-01-08 19:37:25 -08:00
|
|
|
|
2013-05-24 19:35:29 -07:00
|
|
|
// Reexported runtime types
|
2014-03-17 14:34:25 -07:00
|
|
|
pub use comm::{sync_channel, channel, SyncSender, Sender, Receiver};
|
2013-03-13 18:17:12 -07:00
|
|
|
pub use task::spawn;
|
2013-12-02 22:37:26 -08:00
|
|
|
|
2013-12-17 16:46:18 -08:00
|
|
|
// Reexported statics
|
|
|
|
#[cfg(not(test))]
|
|
|
|
pub use gc::GC;
|