]> git.lizzy.rs Git - rust.git/blob - src/libstd/prelude.rs
e3e042a4947240033faab4367a948f422b743948
[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
30 // Reexported core operators
31 pub use either::{Either, Left, Right};
32 pub use kinds::Sized;
33 pub use kinds::{Freeze, Send};
34 pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not};
35 pub use ops::{BitAnd, BitOr, BitXor};
36 pub use ops::{Drop};
37 pub use ops::{Shl, Shr, Index};
38 pub use option::{Option, Some, None};
39 pub use result::{Result, Ok, Err};
40
41 // Reexported functions
42 pub use io::{print, println};
43
44 // Reexported types and traits
45 pub use clone::{Clone, DeepClone};
46 pub use cmp::{Eq, ApproxEq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater, Equiv};
47 pub use char::Char;
48 pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
49 pub use hash::Hash;
50 pub use iter::Times;
51 pub use iterator::{Iterator, IteratorUtil, DoubleEndedIterator, DoubleEndedIteratorUtil};
52 pub use iterator::OrdIterator;
53 pub use num::{Num, NumCast};
54 pub use num::{Orderable, Signed, Unsigned, Round};
55 pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic};
56 pub use num::{Integer, Fractional, Real, RealExt};
57 pub use num::{Bitwise, BitCount, Bounded};
58 pub use num::{Primitive, Int, Float};
59 pub use path::GenericPath;
60 pub use path::Path;
61 pub use path::PosixPath;
62 pub use path::WindowsPath;
63 pub use ptr::RawPtr;
64 pub use ascii::{Ascii, AsciiCast, OwnedAsciiCast, AsciiStr, ToBytesConsume};
65 pub use str::{Str, StrVector, StrSlice, OwnedStr, StrUtil, NullTerminatedStr};
66 pub use from_str::{FromStr};
67 pub use to_bytes::IterBytes;
68 pub use to_str::{ToStr, ToStrConsume};
69 pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
70 pub use tuple::{CloneableTuple2, CloneableTuple3, CloneableTuple4, CloneableTuple5};
71 pub use tuple::{CloneableTuple6, CloneableTuple7, CloneableTuple8, CloneableTuple9};
72 pub use tuple::{CloneableTuple10, CloneableTuple11, CloneableTuple12};
73 pub use tuple::{ImmutableTuple2, ImmutableTuple3, ImmutableTuple4, ImmutableTuple5};
74 pub use tuple::{ImmutableTuple6, ImmutableTuple7, ImmutableTuple8, ImmutableTuple9};
75 pub use tuple::{ImmutableTuple10, ImmutableTuple11, ImmutableTuple12};
76 pub use vec::{Vector, VectorVector, CopyableVector, ImmutableVector};
77 pub use vec::{ImmutableEqVector, ImmutableTotalOrdVector, ImmutableCopyableVector};
78 pub use vec::{OwnedVector, OwnedCopyableVector,OwnedEqVector, MutableVector};
79 pub use io::{Reader, ReaderUtil, Writer, WriterUtil};
80
81 // Reexported runtime types
82 pub use comm::{stream, Port, Chan, GenericChan, GenericSmartChan, GenericPort, Peekable};
83 pub use task::spawn;