]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
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 | //! | |
62682a34 SL |
13 | //! See [std::collections](../std/collections) for a detailed discussion of |
14 | //! collections in Rust. | |
1a4d82fc | 15 | |
c34b1796 AL |
16 | // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364) |
17 | #![cfg_attr(stage0, feature(custom_attribute))] | |
1a4d82fc | 18 | #![crate_name = "collections"] |
1a4d82fc JJ |
19 | #![staged_api] |
20 | #![crate_type = "rlib"] | |
62682a34 SL |
21 | #![unstable(feature = "collections", |
22 | reason = "library is unlikely to be stabilized with the current \ | |
23 | layout and name, use std::collections instead")] | |
1a4d82fc | 24 | #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", |
62682a34 | 25 | html_favicon_url = "https://doc.rust-lang.org/favicon.ico", |
1a4d82fc | 26 | html_root_url = "http://doc.rust-lang.org/nightly/", |
62682a34 SL |
27 | html_playground_url = "http://play.rust-lang.org/", |
28 | test(no_crate_inject))] | |
1a4d82fc | 29 | |
c34b1796 | 30 | #![allow(trivial_casts)] |
62682a34 SL |
31 | #![cfg_attr(test, allow(deprecated))] // rand |
32 | ||
85aaf69f | 33 | #![feature(alloc)] |
85aaf69f | 34 | #![feature(box_patterns)] |
62682a34 SL |
35 | #![feature(box_raw)] |
36 | #![feature(box_syntax)] | |
85aaf69f | 37 | #![feature(core)] |
62682a34 SL |
38 | #![feature(core_intrinsics)] |
39 | #![feature(core_prelude)] | |
40 | #![feature(core_slice_ext)] | |
41 | #![feature(core_str_ext)] | |
42 | #![feature(heap_api)] | |
43 | #![feature(iter_cmp)] | |
44 | #![feature(iter_idx)] | |
45 | #![feature(iter_order)] | |
46 | #![feature(iter_arith)] | |
47 | #![feature(iter_arith)] | |
c34b1796 | 48 | #![feature(lang_items)] |
62682a34 SL |
49 | #![feature(num_bits_bytes)] |
50 | #![feature(oom)] | |
51 | #![feature(pattern)] | |
52 | #![feature(ptr_as_ref)] | |
53 | #![feature(raw)] | |
54 | #![feature(slice_patterns)] | |
85aaf69f | 55 | #![feature(staged_api)] |
62682a34 SL |
56 | #![feature(step_by)] |
57 | #![feature(str_char)] | |
58 | #![feature(str_match_indices)] | |
1a4d82fc | 59 | #![feature(unboxed_closures)] |
85aaf69f | 60 | #![feature(unicode)] |
c34b1796 AL |
61 | #![feature(unique)] |
62 | #![feature(unsafe_no_drop_flag, filling_drop)] | |
9346a6ac | 63 | #![feature(utf8_error)] |
62682a34 SL |
64 | #![cfg_attr(test, feature(rand, test))] |
65 | #![cfg_attr(not(test), feature(str_words))] | |
85aaf69f SL |
66 | |
67 | #![feature(no_std)] | |
1a4d82fc JJ |
68 | #![no_std] |
69 | ||
70 | #[macro_use] | |
71 | extern crate core; | |
72 | ||
d9579d0f | 73 | extern crate rustc_unicode; |
1a4d82fc JJ |
74 | extern crate alloc; |
75 | ||
1a4d82fc | 76 | #[cfg(test)] #[macro_use] extern crate std; |
c34b1796 | 77 | #[cfg(test)] extern crate test; |
1a4d82fc JJ |
78 | |
79 | pub use binary_heap::BinaryHeap; | |
85aaf69f SL |
80 | pub use bit_vec::BitVec; |
81 | pub use bit_set::BitSet; | |
1a4d82fc JJ |
82 | pub use btree_map::BTreeMap; |
83 | pub use btree_set::BTreeSet; | |
85aaf69f | 84 | pub use linked_list::LinkedList; |
1a4d82fc | 85 | pub use enum_set::EnumSet; |
85aaf69f | 86 | pub use vec_deque::VecDeque; |
1a4d82fc JJ |
87 | pub use string::String; |
88 | pub use vec::Vec; | |
89 | pub use vec_map::VecMap; | |
90 | ||
91 | // Needed for the vec! macro | |
92 | pub use alloc::boxed; | |
93 | ||
94 | #[macro_use] | |
95 | mod macros; | |
96 | ||
97 | pub mod binary_heap; | |
98 | mod bit; | |
99 | mod btree; | |
c34b1796 | 100 | pub mod borrow; |
1a4d82fc | 101 | pub mod enum_set; |
85aaf69f | 102 | pub mod fmt; |
c34b1796 | 103 | pub mod linked_list; |
d9579d0f | 104 | pub mod range; |
1a4d82fc JJ |
105 | pub mod slice; |
106 | pub mod str; | |
107 | pub mod string; | |
108 | pub mod vec; | |
c34b1796 | 109 | pub mod vec_deque; |
1a4d82fc JJ |
110 | pub mod vec_map; |
111 | ||
62682a34 | 112 | #[unstable(feature = "bitvec", reason = "RFC 509")] |
85aaf69f SL |
113 | pub mod bit_vec { |
114 | pub use bit::{BitVec, Iter}; | |
1a4d82fc JJ |
115 | } |
116 | ||
62682a34 | 117 | #[unstable(feature = "bitset", reason = "RFC 509")] |
85aaf69f SL |
118 | pub mod bit_set { |
119 | pub use bit::{BitSet, Union, Intersection, Difference, SymmetricDifference}; | |
1a4d82fc JJ |
120 | pub use bit::SetIter as Iter; |
121 | } | |
122 | ||
85aaf69f | 123 | #[stable(feature = "rust1", since = "1.0.0")] |
1a4d82fc JJ |
124 | pub mod btree_map { |
125 | pub use btree::map::*; | |
126 | } | |
127 | ||
85aaf69f | 128 | #[stable(feature = "rust1", since = "1.0.0")] |
1a4d82fc JJ |
129 | pub mod btree_set { |
130 | pub use btree::set::*; | |
131 | } | |
132 | ||
133 | ||
1a4d82fc JJ |
134 | // FIXME(#14344) this shouldn't be necessary |
135 | #[doc(hidden)] | |
62682a34 | 136 | #[unstable(feature = "issue_14344_fixme")] |
1a4d82fc JJ |
137 | pub fn fixme_14344_be_sure_to_link_to_collections() {} |
138 | ||
139 | #[cfg(not(test))] | |
140 | mod std { | |
85aaf69f | 141 | pub use core::ops; // RangeFull |
1a4d82fc JJ |
142 | } |
143 | ||
85aaf69f | 144 | /// An endpoint of a range of keys. |
62682a34 | 145 | #[unstable(feature = "collections_bound")] |
c34b1796 | 146 | #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] |
85aaf69f SL |
147 | pub enum Bound<T> { |
148 | /// An inclusive bound. | |
149 | Included(T), | |
150 | /// An exclusive bound. | |
151 | Excluded(T), | |
152 | /// An infinite endpoint. Indicates that there is no bound in this direction. | |
153 | Unbounded, | |
154 | } |