]> git.proxmox.com Git - rustc.git/blame - src/libcollections/lib.rs
New upstream version 1.13.0+dfsg1
[rustc.git] / src / libcollections / lib.rs
CommitLineData
1a4d82fc
JJ
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//!
9cc50fc6 13//! See [std::collections](../std/collections/index.html) for a detailed discussion of
62682a34 14//! collections in Rust.
1a4d82fc 15
1a4d82fc 16#![crate_name = "collections"]
1a4d82fc 17#![crate_type = "rlib"]
62682a34
SL
18#![unstable(feature = "collections",
19 reason = "library is unlikely to be stabilized with the current \
e9174d1e
SL
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",
62682a34 23 html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
e9174d1e
SL
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/",
92a42be0 27 test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
1a4d82fc 28
62682a34 29#![cfg_attr(test, allow(deprecated))] // rand
7453a54e 30#![cfg_attr(not(stage0), deny(warnings))]
62682a34 31
85aaf69f 32#![feature(alloc)]
54a0048b 33#![feature(allow_internal_unstable)]
85aaf69f 34#![feature(box_patterns)]
62682a34 35#![feature(box_syntax)]
5bcae85e 36#![cfg_attr(not(test), feature(char_escape_debug))]
62682a34 37#![feature(core_intrinsics)]
9cc50fc6 38#![feature(dropck_parametricity)]
b039eaaf 39#![feature(fmt_internals)]
9e0c209e 40#![feature(fused)]
62682a34 41#![feature(heap_api)]
54a0048b 42#![feature(inclusive_range)]
c34b1796 43#![feature(lang_items)]
9cc50fc6 44#![feature(nonzero)]
62682a34 45#![feature(pattern)]
7453a54e
SL
46#![feature(placement_in)]
47#![feature(placement_new_protocol)]
9cc50fc6 48#![feature(shared)]
62682a34 49#![feature(slice_patterns)]
54a0048b 50#![feature(specialization)]
85aaf69f 51#![feature(staged_api)]
62682a34 52#![feature(step_by)]
85aaf69f 53#![feature(unicode)]
c34b1796 54#![feature(unique)]
9e0c209e 55#![cfg_attr(stage0, feature(unsafe_no_drop_flag))]
7453a54e 56#![cfg_attr(test, feature(rand, test))]
85aaf69f 57
1a4d82fc
JJ
58#![no_std]
59
d9579d0f 60extern crate rustc_unicode;
1a4d82fc
JJ
61extern crate alloc;
62
92a42be0
SL
63#[cfg(test)]
64#[macro_use]
65extern crate std;
66#[cfg(test)]
67extern crate test;
1a4d82fc 68
54a0048b 69#[doc(no_inline)]
1a4d82fc 70pub use binary_heap::BinaryHeap;
54a0048b 71#[doc(no_inline)]
1a4d82fc 72pub use btree_map::BTreeMap;
54a0048b 73#[doc(no_inline)]
1a4d82fc 74pub use btree_set::BTreeSet;
54a0048b 75#[doc(no_inline)]
85aaf69f 76pub use linked_list::LinkedList;
54a0048b 77#[doc(no_inline)]
1a4d82fc 78pub use enum_set::EnumSet;
54a0048b 79#[doc(no_inline)]
85aaf69f 80pub use vec_deque::VecDeque;
54a0048b 81#[doc(no_inline)]
1a4d82fc 82pub use string::String;
54a0048b 83#[doc(no_inline)]
1a4d82fc 84pub use vec::Vec;
1a4d82fc
JJ
85
86// Needed for the vec! macro
87pub use alloc::boxed;
88
89#[macro_use]
90mod macros;
91
92pub mod binary_heap;
1a4d82fc 93mod btree;
c34b1796 94pub mod borrow;
1a4d82fc 95pub mod enum_set;
85aaf69f 96pub mod fmt;
c34b1796 97pub mod linked_list;
d9579d0f 98pub mod range;
1a4d82fc
JJ
99pub mod slice;
100pub mod str;
101pub mod string;
102pub mod vec;
c34b1796 103pub mod vec_deque;
1a4d82fc 104
85aaf69f 105#[stable(feature = "rust1", since = "1.0.0")]
1a4d82fc 106pub mod btree_map {
3157f602 107 //! A map based on a B-Tree.
92a42be0 108 #[stable(feature = "rust1", since = "1.0.0")]
1a4d82fc
JJ
109 pub use btree::map::*;
110}
111
85aaf69f 112#[stable(feature = "rust1", since = "1.0.0")]
1a4d82fc 113pub mod btree_set {
3157f602 114 //! A set based on a B-Tree.
92a42be0 115 #[stable(feature = "rust1", since = "1.0.0")]
1a4d82fc
JJ
116 pub use btree::set::*;
117}
118
1a4d82fc
JJ
119#[cfg(not(test))]
120mod std {
85aaf69f 121 pub use core::ops; // RangeFull
1a4d82fc
JJ
122}
123
85aaf69f 124/// An endpoint of a range of keys.
e9174d1e 125#[unstable(feature = "collections_bound", issue = "27787")]
c34b1796 126#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
85aaf69f
SL
127pub 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}
a7813a04
XL
135
136/// An intermediate trait for specialization of `Extend`.
137#[doc(hidden)]
138trait SpecExtend<I: IntoIterator> {
139 /// Extends `self` with the contents of the given iterator.
140 fn spec_extend(&mut self, iter: I);
141}