]> git.lizzy.rs Git - rust.git/blob - src/libcollections/lib.rs
remove unused mut qualifiers
[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
16 #![crate_name = "collections"]
17 #![unstable(feature = "collections")]
18 #![staged_api]
19 #![crate_type = "rlib"]
20 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
21        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
22        html_root_url = "http://doc.rust-lang.org/nightly/",
23        html_playground_url = "http://play.rust-lang.org/")]
24
25 #![feature(alloc)]
26 #![feature(box_syntax)]
27 #![feature(core)]
28 #![feature(hash)]
29 #![feature(int_uint)]
30 #![feature(staged_api)]
31 #![feature(unboxed_closures)]
32 #![feature(unicode)]
33 #![feature(unsafe_destructor, slicing_syntax)]
34 #![cfg_attr(test, feature(test))]
35
36 #![no_std]
37
38 #[macro_use]
39 extern crate core;
40
41 extern crate unicode;
42 extern crate alloc;
43
44 #[cfg(test)] extern crate test;
45 #[cfg(test)] #[macro_use] extern crate std;
46 #[cfg(test)] #[macro_use] extern crate log;
47
48 pub use binary_heap::BinaryHeap;
49 pub use bitv::Bitv;
50 pub use bitv_set::BitvSet;
51 pub use btree_map::BTreeMap;
52 pub use btree_set::BTreeSet;
53 pub use dlist::DList;
54 pub use enum_set::EnumSet;
55 pub use ring_buf::RingBuf;
56 pub use string::String;
57 pub use vec::Vec;
58 pub use vec_map::VecMap;
59
60 // Needed for the vec! macro
61 pub use alloc::boxed;
62
63 #[macro_use]
64 mod macros;
65
66 pub mod binary_heap;
67 mod bit;
68 mod btree;
69 pub mod dlist;
70 pub mod enum_set;
71 pub mod ring_buf;
72 pub mod slice;
73 pub mod str;
74 pub mod string;
75 pub mod vec;
76 pub mod vec_map;
77
78 #[unstable(feature = "collections",
79            reason = "RFC 509")]
80 pub mod bitv {
81     pub use bit::{Bitv, Iter};
82 }
83
84 #[unstable(feature = "collections",
85            reason = "RFC 509")]
86 pub mod bitv_set {
87     pub use bit::{BitvSet, Union, Intersection, Difference, SymmetricDifference};
88     pub use bit::SetIter as Iter;
89 }
90
91 #[stable(feature = "rust1", since = "1.0.0")]
92 pub mod btree_map {
93     pub use btree::map::*;
94 }
95
96 #[stable(feature = "rust1", since = "1.0.0")]
97 pub mod btree_set {
98     pub use btree::set::*;
99 }
100
101
102 #[cfg(test)] mod bench;
103
104 // FIXME(#14344) this shouldn't be necessary
105 #[doc(hidden)]
106 pub fn fixme_14344_be_sure_to_link_to_collections() {}
107
108 #[cfg(not(test))]
109 mod std {
110     pub use core::fmt;      // necessary for panic!()
111     pub use core::option;   // necessary for panic!()
112     pub use core::clone;    // derive(Clone)
113     pub use core::cmp;      // derive(Eq, Ord, etc.)
114     pub use core::marker;   // derive(Copy)
115     pub use core::hash;     // derive(Hash)
116     pub use core::ops;      // RangeFull
117     // for-loops
118     pub use core::iter;
119 }
120
121 #[cfg(test)]
122 mod prelude {
123     // from core.
124     pub use core::borrow::IntoCow;
125     pub use core::clone::Clone;
126     pub use core::cmp::{PartialEq, Eq, PartialOrd, Ord};
127     pub use core::cmp::Ordering::{Less, Equal, Greater};
128     pub use core::iter::range;
129     pub use core::iter::{FromIterator, Extend, IteratorExt};
130     pub use core::iter::{Iterator, DoubleEndedIterator, RandomAccessIterator};
131     pub use core::iter::{ExactSizeIterator};
132     pub use core::marker::{Copy, Send, Sized, Sync};
133     pub use core::mem::drop;
134     pub use core::ops::{Drop, Fn, FnMut, FnOnce};
135     pub use core::option::Option;
136     pub use core::option::Option::{Some, None};
137     pub use core::ptr::PtrExt;
138     pub use core::result::Result;
139     pub use core::result::Result::{Ok, Err};
140
141     // in core and collections (may differ).
142     pub use slice::{AsSlice, SliceExt};
143     pub use str::{Str, StrExt};
144
145     // from other crates.
146     pub use alloc::boxed::Box;
147     pub use unicode::char::CharExt;
148
149     // from collections.
150     pub use slice::SliceConcatExt;
151     pub use string::{String, ToString};
152     pub use vec::Vec;
153 }
154
155 /// An endpoint of a range of keys.
156 pub enum Bound<T> {
157     /// An inclusive bound.
158     Included(T),
159     /// An exclusive bound.
160     Excluded(T),
161     /// An infinite endpoint. Indicates that there is no bound in this direction.
162     Unbounded,
163 }