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