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