]> git.lizzy.rs Git - rust.git/blob - src/libcollections/lib.rs
Auto merge of #22541 - Manishearth:rollup, r=Gankro
[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 #![unstable(feature = "collections")]
18 #![staged_api]
19 #![crate_type = "rlib"]
20 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
21        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
22        html_root_url = "http://doc.rust-lang.org/nightly/",
23        html_playground_url = "http://play.rust-lang.org/")]
24
25 #![feature(alloc)]
26 #![feature(box_syntax)]
27 #![feature(box_patterns)]
28 #![feature(core)]
29 #![feature(staged_api)]
30 #![feature(unboxed_closures)]
31 #![feature(unicode)]
32 #![feature(unsafe_destructor)]
33 #![feature(unsafe_no_drop_flag)]
34 #![cfg_attr(test, feature(rand, rustc_private, test))]
35 #![cfg_attr(test, allow(deprecated))] // rand
36
37 #![feature(no_std)]
38 #![no_std]
39
40 #[macro_use]
41 extern crate core;
42
43 extern crate unicode;
44 extern crate alloc;
45
46 #[cfg(test)] extern crate test;
47 #[cfg(test)] #[macro_use] extern crate std;
48 #[cfg(test)] #[macro_use] extern crate log;
49
50 pub use binary_heap::BinaryHeap;
51 pub use bit_vec::BitVec;
52 pub use bit_set::BitSet;
53 pub use btree_map::BTreeMap;
54 pub use btree_set::BTreeSet;
55 pub use linked_list::LinkedList;
56 pub use enum_set::EnumSet;
57 pub use vec_deque::VecDeque;
58 pub use string::String;
59 pub use vec::Vec;
60 pub use vec_map::VecMap;
61
62 #[deprecated(since = "1.0.0", reason = "renamed to vec_deque")]
63 #[unstable(feature = "collections")]
64 pub use vec_deque as ring_buf;
65
66 #[deprecated(since = "1.0.0", reason = "renamed to linked_list")]
67 #[unstable(feature = "collections")]
68 pub use linked_list as dlist;
69
70 #[deprecated(since = "1.0.0", reason = "renamed to bit_vec")]
71 #[unstable(feature = "collections")]
72 pub use bit_vec as bitv;
73
74 #[deprecated(since = "1.0.0", reason = "renamed to bit_set")]
75 #[unstable(feature = "collections")]
76 pub use bit_set as bitv_set;
77
78 // Needed for the vec! macro
79 pub use alloc::boxed;
80
81 #[macro_use]
82 mod macros;
83
84 #[cfg(test)] #[macro_use] mod bench;
85
86 pub mod binary_heap;
87 mod bit;
88 mod btree;
89 pub mod linked_list;
90 pub mod enum_set;
91 pub mod fmt;
92 pub mod vec_deque;
93 pub mod slice;
94 pub mod str;
95 pub mod string;
96 pub mod vec;
97 pub mod vec_map;
98
99 #[cfg(stage0)]
100 #[path = "borrow_stage0.rs"]
101 pub mod borrow;
102
103 #[cfg(not(stage0))]
104 pub mod borrow;
105
106 #[unstable(feature = "collections",
107            reason = "RFC 509")]
108 pub mod bit_vec {
109     pub use bit::{BitVec, Iter};
110
111     #[deprecated(since = "1.0.0", reason = "renamed to BitVec")]
112     #[unstable(feature = "collections")]
113     pub use bit::BitVec as Bitv;
114 }
115
116 #[unstable(feature = "collections",
117            reason = "RFC 509")]
118 pub mod bit_set {
119     pub use bit::{BitSet, Union, Intersection, Difference, SymmetricDifference};
120     pub use bit::SetIter as Iter;
121
122     #[deprecated(since = "1.0.0", reason = "renamed to BitSet")]
123     #[unstable(feature = "collections")]
124     pub use bit::BitSet as BitvSet;
125 }
126
127 #[stable(feature = "rust1", since = "1.0.0")]
128 pub mod btree_map {
129     pub use btree::map::*;
130 }
131
132 #[stable(feature = "rust1", since = "1.0.0")]
133 pub mod btree_set {
134     pub use btree::set::*;
135 }
136
137
138 // FIXME(#14344) this shouldn't be necessary
139 #[doc(hidden)]
140 pub fn fixme_14344_be_sure_to_link_to_collections() {}
141
142 #[cfg(not(test))]
143 mod std {
144     pub use core::ops;      // RangeFull
145 }
146
147 #[cfg(test)]
148 mod prelude {
149     // from core.
150     pub use core::clone::Clone;
151     pub use core::cmp::{PartialEq, Eq, PartialOrd, Ord};
152     pub use core::cmp::Ordering::{Less, Equal, Greater};
153     pub use core::iter::range;
154     pub use core::iter::{FromIterator, Extend, IteratorExt};
155     pub use core::iter::{Iterator, DoubleEndedIterator, RandomAccessIterator};
156     pub use core::iter::{ExactSizeIterator};
157     pub use core::marker::{Copy, Send, Sized, Sync};
158     pub use core::mem::drop;
159     pub use core::ops::{Drop, Fn, FnMut, FnOnce};
160     pub use core::option::Option;
161     pub use core::option::Option::{Some, None};
162     pub use core::ptr::PtrExt;
163     pub use core::result::Result;
164     pub use core::result::Result::{Ok, Err};
165
166     // in core and collections (may differ).
167     pub use slice::{AsSlice, SliceExt};
168     pub use str::{Str, StrExt};
169
170     // from other crates.
171     pub use alloc::boxed::Box;
172     pub use unicode::char::CharExt;
173
174     // from collections.
175     pub use borrow::IntoCow;
176     pub use slice::SliceConcatExt;
177     pub use string::{String, ToString};
178     pub use vec::Vec;
179 }
180
181 /// An endpoint of a range of keys.
182 pub enum Bound<T> {
183     /// An inclusive bound.
184     Included(T),
185     /// An exclusive bound.
186     Excluded(T),
187     /// An infinite endpoint. Indicates that there is no bound in this direction.
188     Unbounded,
189 }