]> git.lizzy.rs Git - rust.git/blob - src/libcollections/lib.rs
Auto merge of #35856 - phimuemue:master, r=brson
[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/index.html) for a detailed discussion of
14 //! collections in Rust.
15
16 #![crate_name = "collections"]
17 #![crate_type = "rlib"]
18 #![unstable(feature = "collections",
19             reason = "library is unlikely to be stabilized with the current \
20                       layout and name, use std::collections instead",
21             issue = "27783")]
22 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
23        html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
24        html_root_url = "https://doc.rust-lang.org/nightly/",
25        html_playground_url = "https://play.rust-lang.org/",
26        issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
27        test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
28
29 #![cfg_attr(test, allow(deprecated))] // rand
30 #![cfg_attr(not(stage0), deny(warnings))]
31
32 #![feature(alloc)]
33 #![feature(allow_internal_unstable)]
34 #![feature(box_patterns)]
35 #![feature(box_syntax)]
36 #![cfg_attr(not(test), feature(char_escape_debug))]
37 #![feature(core_intrinsics)]
38 #![feature(dropck_parametricity)]
39 #![feature(fmt_internals)]
40 #![feature(fused)]
41 #![feature(heap_api)]
42 #![feature(inclusive_range)]
43 #![feature(lang_items)]
44 #![feature(nonzero)]
45 #![feature(pattern)]
46 #![feature(placement_in)]
47 #![feature(placement_new_protocol)]
48 #![feature(shared)]
49 #![feature(slice_patterns)]
50 #![feature(specialization)]
51 #![feature(staged_api)]
52 #![feature(step_by)]
53 #![feature(unicode)]
54 #![feature(unique)]
55 #![cfg_attr(stage0, feature(unsafe_no_drop_flag))]
56 #![cfg_attr(test, feature(rand, test))]
57
58 #![no_std]
59
60 extern crate rustc_unicode;
61 extern crate alloc;
62
63 #[cfg(test)]
64 #[macro_use]
65 extern crate std;
66 #[cfg(test)]
67 extern crate test;
68
69 #[doc(no_inline)]
70 pub use binary_heap::BinaryHeap;
71 #[doc(no_inline)]
72 pub use btree_map::BTreeMap;
73 #[doc(no_inline)]
74 pub use btree_set::BTreeSet;
75 #[doc(no_inline)]
76 pub use linked_list::LinkedList;
77 #[doc(no_inline)]
78 pub use enum_set::EnumSet;
79 #[doc(no_inline)]
80 pub use vec_deque::VecDeque;
81 #[doc(no_inline)]
82 pub use string::String;
83 #[doc(no_inline)]
84 pub use vec::Vec;
85
86 // Needed for the vec! macro
87 pub use alloc::boxed;
88
89 #[macro_use]
90 mod macros;
91
92 pub mod binary_heap;
93 mod btree;
94 pub mod borrow;
95 pub mod enum_set;
96 pub mod fmt;
97 pub mod linked_list;
98 pub mod range;
99 pub mod slice;
100 pub mod str;
101 pub mod string;
102 pub mod vec;
103 pub mod vec_deque;
104
105 #[stable(feature = "rust1", since = "1.0.0")]
106 pub mod btree_map {
107     //! A map based on a B-Tree.
108     #[stable(feature = "rust1", since = "1.0.0")]
109     pub use btree::map::*;
110 }
111
112 #[stable(feature = "rust1", since = "1.0.0")]
113 pub mod btree_set {
114     //! A set based on a B-Tree.
115     #[stable(feature = "rust1", since = "1.0.0")]
116     pub use btree::set::*;
117 }
118
119 #[cfg(not(test))]
120 mod std {
121     pub use core::ops;      // RangeFull
122 }
123
124 /// An endpoint of a range of keys.
125 #[unstable(feature = "collections_bound", issue = "27787")]
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 }
135
136 /// An intermediate trait for specialization of `Extend`.
137 #[doc(hidden)]
138 trait SpecExtend<I: IntoIterator> {
139     /// Extends `self` with the contents of the given iterator.
140     fn spec_extend(&mut self, iter: I);
141 }