]> git.lizzy.rs Git - rust.git/blob - src/libstd/prelude.rs
auto merge of #10977 : brson/rust/androidtest, r=brson
[rust.git] / src / libstd / prelude.rs
1 // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 /*!
12
13 Many programming languages have a 'prelude': a particular subset of the
14 libraries that come with the language. Every program imports the prelude by
15 default.
16
17 For example, it would be annoying to add `use std::io::println;` to every single
18 program, and the vast majority of Rust programs will wish to print to standard
19 output. Therefore, it makes sense to import it into every program.
20
21 Rust's prelude has three main parts:
22
23 1. io::print and io::println.
24 2. Core operators, such as `Add`, `Mul`, and `Not`.
25 3. Various types and traits, such as `Clone`, `Eq`, and `comm::Chan`.
26
27 */
28
29 // Reexported core operators
30 pub use either::{Either, Left, Right};
31 pub use kinds::Sized;
32 pub use kinds::{Freeze, Send};
33 pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not};
34 pub use ops::{BitAnd, BitOr, BitXor};
35 pub use ops::{Drop};
36 pub use ops::{Shl, Shr, Index};
37 pub use option::{Option, Some, None};
38 pub use result::{Result, Ok, Err};
39
40 #[cfg(not(stage0))]
41 pub use kinds::Pod;
42
43 // Reexported functions
44 pub use from_str::from_str;
45 pub use iter::range;
46 pub use io::stdio::{print, println};
47
48 // Reexported types and traits
49
50 pub use any::{Any, AnyOwnExt, AnyRefExt, AnyMutRefExt};
51 pub use ascii::{Ascii, AsciiCast, OwnedAsciiCast, AsciiStr, IntoBytes};
52 pub use bool::Bool;
53 pub use c_str::ToCStr;
54 pub use char::Char;
55 pub use clone::{Clone, DeepClone};
56 pub use cmp::{Eq, ApproxEq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater, Equiv};
57 pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
58 pub use default::Default;
59 pub use from_str::FromStr;
60 pub use hash::Hash;
61 pub use iter::{FromIterator, Extendable};
62 pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, ClonableIterator};
63 pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize};
64 pub use num::Times;
65 pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic};
66 pub use num::{Bitwise, BitCount, Bounded};
67 pub use num::{Integer, Fractional, Real, RealExt};
68 pub use num::{Num, NumCast, CheckedAdd, CheckedSub, CheckedMul};
69 pub use num::{Orderable, Signed, Unsigned, Round};
70 pub use num::{Primitive, Int, Float, ToStrRadix, ToPrimitive, FromPrimitive};
71 pub use path::{GenericPath, Path, PosixPath, WindowsPath};
72 pub use ptr::RawPtr;
73 pub use io::{Buffer, Writer, Reader, Seek};
74 pub use send_str::{SendStr, SendStrOwned, SendStrStatic, IntoSendStr};
75 pub use str::{Str, StrVector, StrSlice, OwnedStr};
76 pub use to_bytes::IterBytes;
77 pub use to_str::{ToStr, IntoStr};
78 pub use tuple::{CopyableTuple, ImmutableTuple};
79 pub use tuple::{ImmutableTuple1, ImmutableTuple2, ImmutableTuple3, ImmutableTuple4};
80 pub use tuple::{ImmutableTuple5, ImmutableTuple6, ImmutableTuple7, ImmutableTuple8};
81 pub use tuple::{ImmutableTuple9, ImmutableTuple10, ImmutableTuple11, ImmutableTuple12};
82 pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
83 pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
84 pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
85 pub use vec::{ImmutableEqVector, ImmutableTotalOrdVector, ImmutableCopyableVector};
86 pub use vec::{OwnedVector, OwnedCopyableVector,OwnedEqVector, MutableVector};
87 pub use vec::{Vector, VectorVector, CopyableVector, ImmutableVector};
88
89 // Reexported runtime types
90 pub use comm::{Port, Chan, SharedChan};
91 pub use task::spawn;
92
93 /// Disposes of a value.
94 #[inline]
95 pub fn drop<T>(_x: T) { }