]> git.lizzy.rs Git - rust.git/blob - src/libcollections/lib.rs
cbd8d4955b217441ec48f79ade77b68494cd78ea
[rust.git] / src / libcollections / lib.rs
1 // Copyright 2013-2014 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 //! Collection types.
12 //!
13 //! See [std::collections](../std/collections) for a detailed discussion of collections in Rust.
14
15
16 #![crate_name = "collections"]
17 #![experimental]
18 #![crate_type = "rlib"]
19 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
20        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
21        html_root_url = "http://doc.rust-lang.org/nightly/",
22        html_playground_url = "http://play.rust-lang.org/")]
23
24 #![allow(unknown_features)]
25 #![feature(macro_rules, default_type_params, phase, globs)]
26 #![feature(unsafe_destructor, slicing_syntax)]
27 #![feature(unboxed_closures)]
28 #![no_std]
29
30 #[phase(plugin, link)] extern crate core;
31 extern crate unicode;
32 extern crate alloc;
33
34 #[cfg(test)] extern crate test;
35
36 #[cfg(test)] #[phase(plugin, link)] extern crate std;
37 #[cfg(test)] #[phase(plugin, link)] extern crate log;
38
39
40 pub use binary_heap::BinaryHeap;
41 pub use bitv::Bitv;
42 pub use bitv_set::BitvSet;
43 pub use btree_map::BTreeMap;
44 pub use btree_set::BTreeSet;
45 pub use dlist::DList;
46 pub use enum_set::EnumSet;
47 pub use ring_buf::RingBuf;
48 pub use string::String;
49 pub use vec::Vec;
50 pub use vec_map::VecMap;
51
52 mod macros;
53
54 pub mod binary_heap;
55 mod bit;
56 mod btree;
57 pub mod dlist;
58 pub mod enum_set;
59 pub mod ring_buf;
60 pub mod slice;
61 pub mod str;
62 pub mod string;
63 pub mod vec;
64 pub mod vec_map;
65
66 pub mod bitv {
67     pub use bit::{Bitv, Iter, from_fn, from_bytes};
68 }
69
70 pub mod bitv_set {
71     pub use bit::{BitvSet, Union, Intersection, Difference, SymmetricDifference};
72     pub use bit::SetIter as Iter;
73 }
74
75 pub mod btree_map {
76     pub use btree::map::*;
77 }
78
79 pub mod btree_set {
80     pub use btree::set::*;
81 }
82
83
84 #[cfg(test)] mod bench;
85
86 // FIXME(#14344) this shouldn't be necessary
87 #[doc(hidden)]
88 pub fn fixme_14344_be_sure_to_link_to_collections() {}
89
90 #[cfg(not(test))]
91 mod std {
92     pub use core::fmt;      // necessary for panic!()
93     pub use core::option;   // necessary for panic!()
94     pub use core::clone;    // deriving(Clone)
95     pub use core::cmp;      // deriving(Eq, Ord, etc.)
96     pub use core::kinds;    // deriving(Copy)
97     pub use core::hash;     // deriving(Hash)
98 }
99
100 #[cfg(test)]
101 mod prelude {
102     // from core.
103     pub use core::borrow::IntoCow;
104     pub use core::char::Char;
105     pub use core::clone::Clone;
106     pub use core::cmp::{PartialEq, Eq, Equiv, PartialOrd, Ord};
107     pub use core::cmp::Ordering::{Less, Equal, Greater};
108     pub use core::iter::range;
109     pub use core::iter::{FromIterator, Extend, IteratorExt};
110     pub use core::iter::{Iterator, DoubleEndedIterator, RandomAccessIterator};
111     pub use core::iter::{IteratorCloneExt, CloneIteratorExt, DoubleEndedIteratorExt};
112     pub use core::iter::{IteratorOrdExt, MutableDoubleEndedIterator, ExactSizeIterator};
113     pub use core::kinds::{Copy, Send, Sized, Sync};
114     pub use core::mem::drop;
115     pub use core::ops::{Drop, Fn, FnMut, FnOnce};
116     pub use core::option::Option;
117     pub use core::option::Option::{Some, None};
118     pub use core::ptr::PtrExt;
119     pub use core::result::Result;
120     pub use core::result::Result::{Ok, Err};
121
122     // in core and collections (may differ).
123     pub use slice::{PartialEqSliceExt, OrdSliceExt};
124     pub use slice::{AsSlice, SliceExt};
125     pub use str::{from_str, Str, StrExt};
126
127     // from other crates.
128     pub use alloc::boxed::Box;
129     pub use unicode::char::UnicodeChar;
130
131     // from collections.
132     pub use slice::{CloneSliceExt, SliceConcatExt};
133     pub use str::IntoMaybeOwned;
134     pub use string::{String, ToString};
135     pub use vec::Vec;
136 }