]> git.lizzy.rs Git - rust.git/blob - src/libcollections/lib.rs
6c233a31149e7c7d4293cfc05fe9f1d5262927c2
[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 = "https://doc.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(unique)]
37 #![feature(unsafe_no_drop_flag, filling_drop)]
38 #![feature(step_by)]
39 #![feature(str_char)]
40 #![feature(slice_patterns)]
41 #![feature(utf8_error)]
42 #![cfg_attr(test, feature(rand, test))]
43 #![cfg_attr(test, allow(deprecated))] // rand
44 #![cfg_attr(not(test), feature(str_words))]
45
46 #![feature(no_std)]
47 #![no_std]
48
49 #[macro_use]
50 extern crate core;
51
52 extern crate rustc_unicode;
53 extern crate alloc;
54
55 #[cfg(test)] #[macro_use] extern crate std;
56 #[cfg(test)] extern crate test;
57
58 pub use binary_heap::BinaryHeap;
59 pub use bit_vec::BitVec;
60 pub use bit_set::BitSet;
61 pub use btree_map::BTreeMap;
62 pub use btree_set::BTreeSet;
63 pub use linked_list::LinkedList;
64 pub use enum_set::EnumSet;
65 pub use vec_deque::VecDeque;
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;
79 pub mod borrow;
80 pub mod enum_set;
81 pub mod fmt;
82 pub mod linked_list;
83 pub mod range;
84 pub mod slice;
85 pub mod str;
86 pub mod string;
87 pub mod vec;
88 pub mod vec_deque;
89 pub mod vec_map;
90
91 #[unstable(feature = "collections",
92            reason = "RFC 509")]
93 pub mod bit_vec {
94     pub use bit::{BitVec, Iter};
95 }
96
97 #[unstable(feature = "collections",
98            reason = "RFC 509")]
99 pub mod bit_set {
100     pub use bit::{BitSet, Union, Intersection, Difference, SymmetricDifference};
101     pub use bit::SetIter as Iter;
102 }
103
104 #[stable(feature = "rust1", since = "1.0.0")]
105 pub mod btree_map {
106     pub use btree::map::*;
107 }
108
109 #[stable(feature = "rust1", since = "1.0.0")]
110 pub mod btree_set {
111     pub use btree::set::*;
112 }
113
114
115 // FIXME(#14344) this shouldn't be necessary
116 #[doc(hidden)]
117 pub fn fixme_14344_be_sure_to_link_to_collections() {}
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 #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
126 pub enum Bound<T> {
127     /// An inclusive bound.
128     Included(T),
129     /// An exclusive bound.
130     Excluded(T),
131     /// An infinite endpoint. Indicates that there is no bound in this direction.
132     Unbounded,
133 }