]> git.proxmox.com Git - rustc.git/blob - src/libcollections/lib.rs
Imported Upstream version 1.2.0+dfsg1
[rustc.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
14 //! collections in Rust.
15
16 // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
17 #![cfg_attr(stage0, feature(custom_attribute))]
18 #![crate_name = "collections"]
19 #![staged_api]
20 #![crate_type = "rlib"]
21 #![unstable(feature = "collections",
22 reason = "library is unlikely to be stabilized with the current \
23 layout and name, use std::collections instead")]
24 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
25 html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
26 html_root_url = "http://doc.rust-lang.org/nightly/",
27 html_playground_url = "http://play.rust-lang.org/",
28 test(no_crate_inject))]
29
30 #![allow(trivial_casts)]
31 #![cfg_attr(test, allow(deprecated))] // rand
32
33 #![feature(alloc)]
34 #![feature(box_patterns)]
35 #![feature(box_raw)]
36 #![feature(box_syntax)]
37 #![feature(core)]
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)]
48 #![feature(lang_items)]
49 #![feature(num_bits_bytes)]
50 #![feature(oom)]
51 #![feature(pattern)]
52 #![feature(ptr_as_ref)]
53 #![feature(raw)]
54 #![feature(slice_patterns)]
55 #![feature(staged_api)]
56 #![feature(step_by)]
57 #![feature(str_char)]
58 #![feature(str_match_indices)]
59 #![feature(unboxed_closures)]
60 #![feature(unicode)]
61 #![feature(unique)]
62 #![feature(unsafe_no_drop_flag, filling_drop)]
63 #![feature(utf8_error)]
64 #![cfg_attr(test, feature(rand, test))]
65 #![cfg_attr(not(test), feature(str_words))]
66
67 #![feature(no_std)]
68 #![no_std]
69
70 #[macro_use]
71 extern crate core;
72
73 extern crate rustc_unicode;
74 extern crate alloc;
75
76 #[cfg(test)] #[macro_use] extern crate std;
77 #[cfg(test)] extern crate test;
78
79 pub use binary_heap::BinaryHeap;
80 pub use bit_vec::BitVec;
81 pub use bit_set::BitSet;
82 pub use btree_map::BTreeMap;
83 pub use btree_set::BTreeSet;
84 pub use linked_list::LinkedList;
85 pub use enum_set::EnumSet;
86 pub use vec_deque::VecDeque;
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;
100 pub mod borrow;
101 pub mod enum_set;
102 pub mod fmt;
103 pub mod linked_list;
104 pub mod range;
105 pub mod slice;
106 pub mod str;
107 pub mod string;
108 pub mod vec;
109 pub mod vec_deque;
110 pub mod vec_map;
111
112 #[unstable(feature = "bitvec", reason = "RFC 509")]
113 pub mod bit_vec {
114 pub use bit::{BitVec, Iter};
115 }
116
117 #[unstable(feature = "bitset", 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
123 #[stable(feature = "rust1", since = "1.0.0")]
124 pub mod btree_map {
125 pub use btree::map::*;
126 }
127
128 #[stable(feature = "rust1", since = "1.0.0")]
129 pub mod btree_set {
130 pub use btree::set::*;
131 }
132
133
134 // FIXME(#14344) this shouldn't be necessary
135 #[doc(hidden)]
136 #[unstable(feature = "issue_14344_fixme")]
137 pub fn fixme_14344_be_sure_to_link_to_collections() {}
138
139 #[cfg(not(test))]
140 mod std {
141 pub use core::ops; // RangeFull
142 }
143
144 /// An endpoint of a range of keys.
145 #[unstable(feature = "collections_bound")]
146 #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
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 }