]> git.lizzy.rs Git - rust.git/blob - src/libcollections/lib.rs
Auto merge of #24865 - bluss:range-size, r=alexcrichton
[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 // 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                           collections_drain, collections_range))]
47 #![cfg_attr(test, allow(deprecated))] // rand
48
49 #![feature(no_std)]
50 #![no_std]
51
52 #[macro_use]
53 extern crate core;
54
55 extern crate rustc_unicode;
56 extern crate alloc;
57
58 #[cfg(test)] #[macro_use] extern crate std;
59 #[cfg(test)] extern crate test;
60
61 pub use binary_heap::BinaryHeap;
62 pub use bit_vec::BitVec;
63 pub use bit_set::BitSet;
64 pub use btree_map::BTreeMap;
65 pub use btree_set::BTreeSet;
66 pub use linked_list::LinkedList;
67 pub use enum_set::EnumSet;
68 pub use vec_deque::VecDeque;
69 pub use string::String;
70 pub use vec::Vec;
71 pub use vec_map::VecMap;
72
73 // Needed for the vec! macro
74 pub use alloc::boxed;
75
76 #[macro_use]
77 mod macros;
78
79 pub mod binary_heap;
80 mod bit;
81 mod btree;
82 pub mod borrow;
83 pub mod enum_set;
84 pub mod fmt;
85 pub mod linked_list;
86 pub mod range;
87 pub mod slice;
88 pub mod str;
89 pub mod string;
90 pub mod vec;
91 pub mod vec_deque;
92 pub mod vec_map;
93
94 #[unstable(feature = "collections",
95            reason = "RFC 509")]
96 pub mod bit_vec {
97     pub use bit::{BitVec, Iter};
98 }
99
100 #[unstable(feature = "collections",
101            reason = "RFC 509")]
102 pub mod bit_set {
103     pub use bit::{BitSet, Union, Intersection, Difference, SymmetricDifference};
104     pub use bit::SetIter as Iter;
105 }
106
107 #[stable(feature = "rust1", since = "1.0.0")]
108 pub mod btree_map {
109     pub use btree::map::*;
110 }
111
112 #[stable(feature = "rust1", since = "1.0.0")]
113 pub mod btree_set {
114     pub use btree::set::*;
115 }
116
117
118 // FIXME(#14344) this shouldn't be necessary
119 #[doc(hidden)]
120 pub fn fixme_14344_be_sure_to_link_to_collections() {}
121
122 #[cfg(not(test))]
123 mod std {
124     pub use core::ops;      // RangeFull
125 }
126
127 /// An endpoint of a range of keys.
128 #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
129 pub enum Bound<T> {
130     /// An inclusive bound.
131     Included(T),
132     /// An exclusive bound.
133     Excluded(T),
134     /// An infinite endpoint. Indicates that there is no bound in this direction.
135     Unbounded,
136 }