]> git.lizzy.rs Git - rust.git/commitdiff
core: Move the collections traits to libcollections
authorAlex Crichton <alex@alexcrichton.com>
Fri, 6 Jun 2014 23:33:44 +0000 (16:33 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 9 Jun 2014 07:38:46 +0000 (00:38 -0700)
This commit moves Mutable, Map, MutableMap, Set, and MutableSet from
`core::collections` to the `collections` crate at the top-level. Additionally,
this removes the `deque` module and moves the `Deque` trait to only being
available at the top-level of the collections crate.

All functionality continues to be reexported through `std::collections`.

[breaking-change]

25 files changed:
src/libcollections/bitv.rs
src/libcollections/btree.rs
src/libcollections/deque.rs
src/libcollections/dlist.rs
src/libcollections/lib.rs
src/libcollections/priority_queue.rs
src/libcollections/ringbuf.rs
src/libcollections/slice.rs
src/libcollections/smallintmap.rs
src/libcollections/str.rs
src/libcollections/string.rs
src/libcollections/treemap.rs
src/libcollections/trie.rs
src/libcollections/vec.rs
src/libcore/collections.rs
src/libstd/collections/hashmap.rs
src/libstd/collections/lru_cache.rs
src/libstd/collections/mod.rs
src/libstd/lib.rs
src/libstd/path/posix.rs
src/libstd/prelude.rs
src/libstd/rand/os.rs
src/libstd/rand/reader.rs
src/libstd/rt/backtrace.rs
src/test/compile-fail/map-types.rs

index ac31fbbf9e43b59bc3c75e1280a4c3fa6ee5811e..42c8177977057323d89d71363dab68d1defd5390 100644 (file)
@@ -20,6 +20,7 @@
 use core::uint;
 use std::hash;
 
+use {Collection, Mutable, Set, MutableSet};
 use vec::Vec;
 
 #[deriving(Clone)]
@@ -1008,6 +1009,7 @@ mod tests {
     use std::rand::Rng;
     use test::Bencher;
 
+    use {Set, Mutable, MutableSet};
     use bitv::{Bitv, SmallBitv, BigBitv, BitvSet, from_bools, from_fn,
                from_bytes};
     use bitv;
index ebca0157da40be19d728e74ce87f758485ae8480..82abe69a63996fb3aad41a1f4deb81a8a6070a97 100644 (file)
@@ -24,6 +24,7 @@
 use core::fmt;
 use core::fmt::Show;
 
+use Collection;
 use vec::Vec;
 
 #[allow(missing_doc)]
index 5624c67f1084089da0583545b17c269e5f5acd1d..1faa9be99e3a54e919643e4be4f4409d223c5f5b 100644 (file)
 
 //! Container traits for collections
 
-use core::prelude::*;
-
-/// A double-ended sequence that allows querying, insertion and deletion at both ends.
-pub trait Deque<T> : Mutable {
-    /// Provide a reference to the front element, or None if the sequence is empty
-    fn front<'a>(&'a self) -> Option<&'a T>;
-
-    /// Provide a mutable reference to the front element, or None if the sequence is empty
-    fn front_mut<'a>(&'a mut self) -> Option<&'a mut T>;
-
-    /// Provide a reference to the back element, or None if the sequence is empty
-    fn back<'a>(&'a self) -> Option<&'a T>;
-
-    /// Provide a mutable reference to the back element, or None if the sequence is empty
-    fn back_mut<'a>(&'a mut self) -> Option<&'a mut T>;
-
-    /// Insert an element first in the sequence
-    fn push_front(&mut self, elt: T);
-
-    /// Insert an element last in the sequence
-    fn push_back(&mut self, elt: T);
-
-    /// Remove the last element and return it, or None if the sequence is empty
-    fn pop_back(&mut self) -> Option<T>;
-
-    /// Remove the first element and return it, or None if the sequence is empty
-    fn pop_front(&mut self) -> Option<T>;
-}
-
 #[cfg(test)]
 pub mod bench {
     use std::prelude::*;
     use std::rand;
     use std::rand::Rng;
     use test::Bencher;
+    use MutableMap;
 
     pub fn insert_rand_n<M:MutableMap<uint,uint>>(n: uint,
                                                   map: &mut M,
@@ -121,3 +93,4 @@ pub fn find_seq_n<M:MutableMap<uint,uint>>(n: uint,
         })
      }
 }
+
index f71cc7401c58c0547298a10cb5d7fdd24d978646..5a2312456913824a385371596b0b46597620418f 100644 (file)
@@ -13,7 +13,7 @@
 //! The DList allows pushing and popping elements at either end.
 //!
 //! DList implements the trait Deque. It should be imported with `use
-//! collections::deque::Deque`.
+//! collections::Deque`.
 
 // DList is constructed like a singly-linked list over the field `next`.
 // including the last link being None; each Node owns its `next` field.
@@ -29,7 +29,7 @@
 use core::mem;
 use core::ptr;
 
-use deque::Deque;
+use {Collection, Mutable, Deque};
 
 /// A doubly-linked list.
 pub struct DList<T> {
@@ -629,7 +629,7 @@ mod tests {
     use test::Bencher;
     use test;
 
-    use deque::Deque;
+    use Deque;
     use super::{DList, Node, ListInsertion};
     use vec::Vec;
 
index c46ea84a765cea9adace56d880d220a5f8c6fdb7..602ecf39a836c837374bbe167826a9b4895e0b09 100644 (file)
 #[cfg(test)] #[phase(syntax, link)] extern crate std;
 #[cfg(test)] #[phase(syntax, link)] extern crate log;
 
+use core::prelude::*;
+
+pub use core::collections::Collection;
 pub use bitv::{Bitv, BitvSet};
 pub use btree::BTree;
-pub use deque::Deque;
 pub use dlist::DList;
 pub use enum_set::EnumSet;
 pub use priority_queue::PriorityQueue;
@@ -47,7 +49,6 @@
 
 pub mod bitv;
 pub mod btree;
-pub mod deque;
 pub mod dlist;
 pub mod enum_set;
 pub mod priority_queue;
 // Internal unicode fiddly bits for the str module
 mod unicode;
 
-// FIXME(#14008) should this actually exist, or should a method be added?
-fn expect<T>(a: core::option::Option<T>, b: &str) -> T {
-    match a {
-        core::option::Some(a) => a,
-        core::option::None => fail!("{}", b),
+mod deque;
+
+/// A trait to represent mutable containers
+pub trait Mutable: Collection {
+    /// Clear the container, removing all values.
+    fn clear(&mut self);
+}
+
+/// A map is a key-value store where values may be looked up by their keys. This
+/// trait provides basic operations to operate on these stores.
+pub trait Map<K, V>: Collection {
+    /// Return a reference to the value corresponding to the key
+    fn find<'a>(&'a self, key: &K) -> Option<&'a V>;
+
+    /// Return true if the map contains a value for the specified key
+    #[inline]
+    fn contains_key(&self, key: &K) -> bool {
+        self.find(key).is_some()
+    }
+}
+
+/// This trait provides basic operations to modify the contents of a map.
+pub trait MutableMap<K, V>: Map<K, V> + Mutable {
+    /// Insert a key-value pair into the map. An existing value for a
+    /// key is replaced by the new value. Return true if the key did
+    /// not already exist in the map.
+    #[inline]
+    fn insert(&mut self, key: K, value: V) -> bool {
+        self.swap(key, value).is_none()
+    }
+
+    /// Remove a key-value pair from the map. Return true if the key
+    /// was present in the map, otherwise false.
+    #[inline]
+    fn remove(&mut self, key: &K) -> bool {
+        self.pop(key).is_some()
+    }
+
+    /// Insert a key-value pair from the map. If the key already had a value
+    /// present in the map, that value is returned. Otherwise None is returned.
+    fn swap(&mut self, k: K, v: V) -> Option<V>;
+
+    /// Removes a key from the map, returning the value at the key if the key
+    /// was previously in the map.
+    fn pop(&mut self, k: &K) -> Option<V>;
+
+    /// Return a mutable reference to the value corresponding to the key
+    fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V>;
+}
+
+/// A set is a group of objects which are each distinct from one another. This
+/// trait represents actions which can be performed on sets to iterate over
+/// them.
+pub trait Set<T>: Collection {
+    /// Return true if the set contains a value
+    fn contains(&self, value: &T) -> bool;
+
+    /// Return true if the set has no elements in common with `other`.
+    /// This is equivalent to checking for an empty intersection.
+    fn is_disjoint(&self, other: &Self) -> bool;
+
+    /// Return true if the set is a subset of another
+    fn is_subset(&self, other: &Self) -> bool;
+
+    /// Return true if the set is a superset of another
+    fn is_superset(&self, other: &Self) -> bool {
+        other.is_subset(self)
     }
+
+    // FIXME #8154: Add difference, sym. difference, intersection and union iterators
+}
+
+/// This trait represents actions which can be performed on sets to mutate
+/// them.
+pub trait MutableSet<T>: Set<T> + Mutable {
+    /// Add a value to the set. Return true if the value was not already
+    /// present in the set.
+    fn insert(&mut self, value: T) -> bool;
+
+    /// Remove a value from the set. Return true if the value was
+    /// present in the set.
+    fn remove(&mut self, value: &T) -> bool;
+}
+
+/// A double-ended sequence that allows querying, insertion and deletion at both
+/// ends.
+pub trait Deque<T> : Mutable {
+    /// Provide a reference to the front element, or None if the sequence is
+    /// empty
+    fn front<'a>(&'a self) -> Option<&'a T>;
+
+    /// Provide a mutable reference to the front element, or None if the
+    /// sequence is empty
+    fn front_mut<'a>(&'a mut self) -> Option<&'a mut T>;
+
+    /// Provide a reference to the back element, or None if the sequence is
+    /// empty
+    fn back<'a>(&'a self) -> Option<&'a T>;
+
+    /// Provide a mutable reference to the back element, or None if the sequence
+    /// is empty
+    fn back_mut<'a>(&'a mut self) -> Option<&'a mut T>;
+
+    /// Insert an element first in the sequence
+    fn push_front(&mut self, elt: T);
+
+    /// Insert an element last in the sequence
+    fn push_back(&mut self, elt: T);
+
+    /// Remove the last element and return it, or None if the sequence is empty
+    fn pop_back(&mut self) -> Option<T>;
+
+    /// Remove the first element and return it, or None if the sequence is empty
+    fn pop_front(&mut self) -> Option<T>;
 }
 
 // FIXME(#14344) this shouldn't be necessary
index f10c6f230aecb3f1d81e016db5e6ebb4d57ec411..ea3e7d1747170d0d6a1ba197fc7d61de7069af3f 100644 (file)
@@ -17,6 +17,7 @@
 use core::mem::{zeroed, replace, swap};
 use core::ptr;
 
+use {Collection, Mutable};
 use slice;
 use vec::Vec;
 
index 5708dfaf915bc552885606b62ba845f95fdb99c6..addf73d67a88e7f8e0e2cb804c5f8652710f21f6 100644 (file)
@@ -11,7 +11,7 @@
 //! A double-ended queue implemented as a circular buffer
 //!
 //! RingBuf implements the trait Deque. It should be imported with `use
-//! collections::deque::Deque`.
+//! collections::Deque`.
 
 use core::prelude::*;
 
@@ -19,7 +19,7 @@
 use core::fmt;
 use core::iter::RandomAccessIterator;
 
-use deque::Deque;
+use {Deque, Collection, Mutable};
 use vec::Vec;
 
 static INITIAL_CAPACITY: uint = 8u; // 2^3
@@ -415,7 +415,7 @@ mod tests {
     use test::Bencher;
     use test;
 
-    use deque::Deque;
+    use {Deque, Mutable};
     use super::RingBuf;
     use vec::Vec;
 
index 4798218e3ff25dbc9653882f2d64c51c38799b18..1bc563686933e5efa23a23d4407ad8b8c878f55c 100644 (file)
 use core::mem;
 use core::ptr;
 use core::iter::{range_step, MultiplicativeIterator};
+
+use Collection;
 use vec::Vec;
 
 pub use core::slice::{ref_slice, mut_ref_slice, Splits, Windows};
@@ -296,9 +298,9 @@ fn to_owned(&self) -> ~[T] {
 
         let len = self.len();
         let data_size = len.checked_mul(&mem::size_of::<T>());
-        let data_size = ::expect(data_size, "overflow in to_owned()");
+        let data_size = data_size.expect("overflow in to_owned()");
         let size = mem::size_of::<RawVec<()>>().checked_add(&data_size);
-        let size = ::expect(size, "overflow in to_owned()");
+        let size = size.expect("overflow in to_owned()");
 
         unsafe {
             // this should pass the real required alignment
@@ -865,6 +867,7 @@ mod tests {
     use std::rt;
     use slice::*;
 
+    use Mutable;
     use vec::Vec;
 
     fn square(n: uint) -> uint { n * n }
index c61f518caa40eb74465815a5ed83877b388ae316..cc901864ab532b3eab8bbb9ba95a1ac5527b59e0 100644 (file)
@@ -21,6 +21,7 @@
 use core::iter::{Enumerate, FilterMap};
 use core::mem::replace;
 
+use {Collection, Mutable, Map, MutableMap};
 use {vec, slice};
 use vec::Vec;
 
@@ -123,7 +124,7 @@ pub fn with_capacity(capacity: uint) -> SmallIntMap<V> {
     }
 
     pub fn get<'a>(&'a self, key: &uint) -> &'a V {
-        ::expect(self.find(key), "key not present")
+        self.find(key).expect("key not present")
     }
 
     /// An iterator visiting all key-value pairs in ascending order by the keys.
@@ -264,6 +265,7 @@ pub struct MutEntries<'a, T> {
 mod test_map {
     use std::prelude::*;
 
+    use {Map, MutableMap, Mutable};
     use super::SmallIntMap;
 
     #[test]
index 102d9c3abdee9a69bf90719282fef149204b1c24..49d8775dd9cb649a97570ac2416828c7779b7e7d 100644 (file)
@@ -76,6 +76,7 @@ fn main() {
 use core::iter::AdditiveIterator;
 use core::mem;
 
+use Collection;
 use hash;
 use string::String;
 use vec::Vec;
index 1c1d4b98592b1b7f5914e5586047b3627d6e994d..76f53c9b257493216ef5ee9e715ac845fd0560de 100644 (file)
@@ -18,6 +18,7 @@
 use core::ptr;
 use core::raw::Slice;
 
+use {Collection, Mutable};
 use hash;
 use str;
 use str::{CharRange, StrAllocating};
@@ -356,6 +357,7 @@ mod tests {
     use std::prelude::*;
     use test::Bencher;
 
+    use Mutable;
     use str::{Str, StrSlice};
     use super::String;
 
index 8d472282a68d7187dacecdec763558c93f57e6a7..489fe60cebf0ec021c8bb744a57dc7ee1be9aa98 100644 (file)
@@ -22,6 +22,7 @@
 use core::mem::{replace, swap};
 use core::ptr;
 
+use {Collection, Mutable, Set, MutableSet, MutableMap, Map};
 use vec::Vec;
 
 // This is implemented as an AA tree, which is a simplified variation of
@@ -1006,6 +1007,7 @@ mod test_treemap {
     use std::rand::Rng;
     use std::rand;
 
+    use {Map, MutableMap, Mutable};
     use super::{TreeMap, TreeNode};
 
     #[test]
@@ -1437,7 +1439,6 @@ fn test_from_iter() {
 
 #[cfg(test)]
 mod bench {
-    use std::prelude::*;
     use test::Bencher;
 
     use super::TreeMap;
@@ -1500,6 +1501,7 @@ pub fn find_seq_10_000(b: &mut Bencher) {
 mod test_set {
     use std::prelude::*;
 
+    use {Set, MutableSet, Mutable, MutableMap};
     use super::{TreeMap, TreeSet};
 
     #[test]
index 1c6b7ed9333930d214819522f9b5e0e00ae89a9b..6e99d6054a56453b099a1211c8b89c55040be939 100644 (file)
@@ -17,6 +17,7 @@
 use core::mem;
 use core::uint;
 
+use {Collection, Mutable, Map, MutableMap, Set, MutableSet};
 use slice::{Items, MutItems};
 use slice;
 
@@ -645,6 +646,7 @@ mod test_map {
     use std::iter::range_step;
     use std::uint;
 
+    use {MutableMap, Map};
     use super::{TrieMap, TrieNode, Internal, External, Nothing};
 
     fn check_integrity<T>(trie: &TrieNode<T>) {
@@ -923,6 +925,7 @@ mod bench_map {
     use std::rand::{weak_rng, Rng};
     use test::Bencher;
 
+    use MutableMap;
     use super::TrieMap;
 
     #[bench]
@@ -1031,6 +1034,7 @@ mod test_set {
     use std::prelude::*;
     use std::uint;
 
+    use {MutableSet, Set};
     use super::TrieSet;
 
     #[test]
index 3d0182acc7ea8768dfff9bb2e2acb0798b2dcfe6..dbef73efc479462b1539acf7ed8d47eb305648c8 100644 (file)
@@ -24,6 +24,7 @@
 use core::ptr;
 use core::uint;
 
+use {Collection, Mutable};
 use slice::{MutableOrdVector, OwnedVector, MutableVectorAllocating};
 use slice::{Items, MutItems};
 
@@ -91,8 +92,8 @@ pub fn with_capacity(capacity: uint) -> Vec<T> {
         } else if capacity == 0 {
             Vec::new()
         } else {
-            let size = ::expect(capacity.checked_mul(&mem::size_of::<T>()),
-                                "capacity overflow");
+            let size = capacity.checked_mul(&mem::size_of::<T>())
+                               .expect("capacity overflow");
             let ptr = unsafe { allocate(size, mem::min_align_of::<T>()) };
             Vec { len: 0, cap: capacity, ptr: ptr as *mut T }
         }
@@ -499,8 +500,8 @@ pub fn reserve_exact(&mut self, capacity: uint) {
         if mem::size_of::<T>() == 0 { return }
 
         if capacity > self.cap {
-            let size = ::expect(capacity.checked_mul(&mem::size_of::<T>()),
-                                "capacity overflow");
+            let size = capacity.checked_mul(&mem::size_of::<T>())
+                               .expect("capacity overflow");
             unsafe {
                 self.ptr = alloc_or_realloc(self.ptr, size,
                                             self.cap * mem::size_of::<T>());
@@ -579,7 +580,7 @@ pub fn pop(&mut self) -> Option<T> {
     pub fn push(&mut self, value: T) {
         if mem::size_of::<T>() == 0 {
             // zero-size types consume no memory, so we can't rely on the address space running out
-            self.len = ::expect(self.len.checked_add(&1), "length overflow");
+            self.len = self.len.checked_add(&1).expect("length overflow");
             unsafe { mem::forget(value); }
             return
         }
@@ -1526,9 +1527,9 @@ impl<T> FromVec<T> for ~[T] {
     fn from_vec(mut v: Vec<T>) -> ~[T] {
         let len = v.len();
         let data_size = len.checked_mul(&mem::size_of::<T>());
-        let data_size = ::expect(data_size, "overflow in from_vec()");
+        let data_size = data_size.expect("overflow in from_vec()");
         let size = mem::size_of::<RawVec<()>>().checked_add(&data_size);
-        let size = ::expect(size, "overflow in from_vec()");
+        let size = size.expect("overflow in from_vec()");
 
         // In a post-DST world, we can attempt to reuse the Vec allocation by calling
         // shrink_to_fit() on it. That may involve a reallocation+memcpy, but that's no
index 8ebc7c2f7fe2ac675e613e300d7a2d570e0d51de..0bb9289397a70290fdf08572cc8d2a369afb62e6 100644 (file)
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Traits for generic collections (including `Map` and `Set`)
-
-use option::Option;
+//! Traits for generic collections
 
 /// A trait to represent the abstract idea of a container. The only concrete
 /// knowledge known is the number of elements contained within.
@@ -24,85 +22,3 @@ fn is_empty(&self) -> bool {
         self.len() == 0
     }
 }
-
-/// A trait to represent mutable containers
-pub trait Mutable: Collection {
-    /// Clear the container, removing all values.
-    fn clear(&mut self);
-}
-
-/// A map is a key-value store where values may be looked up by their keys. This
-/// trait provides basic operations to operate on these stores.
-pub trait Map<K, V>: Collection {
-    /// Return a reference to the value corresponding to the key
-    fn find<'a>(&'a self, key: &K) -> Option<&'a V>;
-
-    /// Return true if the map contains a value for the specified key
-    #[inline]
-    fn contains_key(&self, key: &K) -> bool {
-        self.find(key).is_some()
-    }
-}
-
-/// This trait provides basic operations to modify the contents of a map.
-pub trait MutableMap<K, V>: Map<K, V> + Mutable {
-    /// Insert a key-value pair into the map. An existing value for a
-    /// key is replaced by the new value. Return true if the key did
-    /// not already exist in the map.
-    #[inline]
-    fn insert(&mut self, key: K, value: V) -> bool {
-        self.swap(key, value).is_none()
-    }
-
-    /// Remove a key-value pair from the map. Return true if the key
-    /// was present in the map, otherwise false.
-    #[inline]
-    fn remove(&mut self, key: &K) -> bool {
-        self.pop(key).is_some()
-    }
-
-    /// Insert a key-value pair from the map. If the key already had a value
-    /// present in the map, that value is returned. Otherwise None is returned.
-    fn swap(&mut self, k: K, v: V) -> Option<V>;
-
-    /// Removes a key from the map, returning the value at the key if the key
-    /// was previously in the map.
-    fn pop(&mut self, k: &K) -> Option<V>;
-
-    /// Return a mutable reference to the value corresponding to the key
-    fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V>;
-}
-
-/// A set is a group of objects which are each distinct from one another. This
-/// trait represents actions which can be performed on sets to iterate over
-/// them.
-pub trait Set<T>: Collection {
-    /// Return true if the set contains a value
-    fn contains(&self, value: &T) -> bool;
-
-    /// Return true if the set has no elements in common with `other`.
-    /// This is equivalent to checking for an empty intersection.
-    fn is_disjoint(&self, other: &Self) -> bool;
-
-    /// Return true if the set is a subset of another
-    fn is_subset(&self, other: &Self) -> bool;
-
-    /// Return true if the set is a superset of another
-    fn is_superset(&self, other: &Self) -> bool {
-        other.is_subset(self)
-    }
-
-    // FIXME #8154: Add difference, sym. difference, intersection and union iterators
-}
-
-/// This trait represents actions which can be performed on sets to mutate
-/// them.
-pub trait MutableSet<T>: Set<T> + Mutable {
-    /// Add a value to the set. Return true if the value was not already
-    /// present in the set.
-    fn insert(&mut self, value: T) -> bool;
-
-    /// Remove a value from the set. Return true if the value was
-    /// present in the set.
-    fn remove(&mut self, value: &T) -> bool;
-}
index 1f3c34600bdd420b399d99adcb717f32c20c2e47..a780b63bfd0269c767732ea51d6690d04caa789d 100644 (file)
@@ -12,7 +12,7 @@
 
 use clone::Clone;
 use cmp::{max, Eq, Equiv, PartialEq};
-use container::{Container, Mutable, Set, MutableSet, Map, MutableMap};
+use collections::{Collection, Mutable, Set, MutableSet, Map, MutableMap};
 use default::Default;
 use fmt::Show;
 use fmt;
@@ -930,7 +930,7 @@ pub fn pop_equiv<Q:Hash<S> + Equiv<K>>(&mut self, k: &Q) -> Option<V> {
     }
 }
 
-impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> Container for HashMap<K, V, H> {
+impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> Collection for HashMap<K, V, H> {
     /// Return the number of elements in the map
     fn len(&self) -> uint { self.table.size() }
 }
@@ -2160,7 +2160,7 @@ mod test_set {
 
     use super::HashSet;
     use slice::ImmutableEqVector;
-    use std::collections::Collection;
+    use collections::Collection;
 
     #[test]
     fn test_disjoint() {
index 5f32abfe65305eaeb96f8af4386971a08c212518..72d96804d6d7e4dd99a571ff7248c2ca37bb8017 100644 (file)
@@ -38,8 +38,7 @@
 //! ```
 
 use cmp::{PartialEq, Eq};
-use collections::HashMap;
-use container::{Container, Mutable, MutableMap};
+use collections::{HashMap, Collection, Mutable, MutableMap};
 use fmt;
 use hash::Hash;
 use iter::{range, Iterator};
index 16a6a35d9d5f751970397317196a692ea911e03b..9e5288f9541b8c1869ac400f8936e36998dbe2b2 100644 (file)
  * Collection types.
  */
 
-pub use core_collections::{Bitv, BitvSet, BTree, Deque, DList, EnumSet};
+pub use core_collections::{Collection, Mutable, Map, MutableMap};
+pub use core_collections::{Set, MutableSet, Deque};
+pub use core_collections::{Bitv, BitvSet, BTree, DList, EnumSet};
 pub use core_collections::{PriorityQueue, RingBuf, SmallIntMap};
 pub use core_collections::{TreeMap, TreeSet, TrieMap, TrieSet};
-pub use core_collections::{bitv, btree, deque, dlist, enum_set};
+pub use core_collections::{bitv, btree, dlist, enum_set};
 pub use core_collections::{priority_queue, ringbuf, smallintmap, treemap, trie};
 
 pub use self::hashmap::{HashMap, HashSet};
index d319d6bd03d1ad619032d13b2c15f82000282a32..fbdbc13e1b430ed1ea95462c2e802e970c6a3a90 100644 (file)
 pub use core::char;
 pub use core::clone;
 #[cfg(not(test))] pub use core::cmp;
-pub use core::collections;
 pub use core::default;
 pub use core::finally;
 pub use core::intrinsics;
index 8dfb64194e7977d1b0809d5fcbe9cf96583e1e99..171535edbeb346b2ac4ce429a9e4f3609db81eba 100644 (file)
@@ -13,7 +13,7 @@
 use c_str::{CString, ToCStr};
 use clone::Clone;
 use cmp::{PartialEq, Eq};
-use container::Container;
+use collections::Collection;
 use from_str::FromStr;
 use hash;
 use io::Writer;
index 54dcbd1812fccaad8feb7eb32ec90580e9d9a34f..485c2140a8d1b035f8b2271a8dba3f4394ff6517 100644 (file)
@@ -60,8 +60,8 @@
 #[doc(no_inline)] pub use clone::Clone;
 #[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
 #[doc(no_inline)] pub use cmp::{Ordering, Less, Equal, Greater, Equiv};
-#[doc(no_inline)] pub use container::{Container, Mutable, Map, MutableMap};
-#[doc(no_inline)] pub use container::{Set, MutableSet};
+#[doc(no_inline)] pub use collections::{Collection, Mutable, Map, MutableMap};
+#[doc(no_inline)] pub use collections::{Set, MutableSet};
 #[doc(no_inline)] pub use iter::{FromIterator, Extendable, ExactSize};
 #[doc(no_inline)] pub use iter::{Iterator, DoubleEndedIterator};
 #[doc(no_inline)] pub use iter::{RandomAccessIterator, CloneableIterator};
index 284d41d3208a382ed72974cda74b4adef7538744..2654b7a1acc6af5145592e931b67a66e1ccb071d 100644 (file)
@@ -62,7 +62,7 @@ fn fill_bytes(&mut self, v: &mut [u8]) {
 mod imp {
     extern crate libc;
 
-    use container::Container;
+    use core_collections::Collection;
     use io::{IoResult, IoError};
     use mem;
     use ops::Drop;
index 170884073f3c3310df9bb277752fe82c0f4a0f76..8655d1e47d51a01772f112c8fde0102bc45c2a82 100644 (file)
@@ -10,7 +10,7 @@
 
 //! A wrapper around any Reader to treat it as an RNG.
 
-use container::Container;
+use collections::Collection;
 use io::Reader;
 use rand::Rng;
 use result::{Ok, Err};
index d52c63abe1b918188b9e3411c29eabed7512c832..83fc95267afdf3333d82335e367bf18e793514c5 100644 (file)
@@ -602,7 +602,7 @@ pub unsafe fn _Unwind_FindEnclosingFunction(pc: *libc::c_void)
 #[allow(dead_code, uppercase_variables)]
 mod imp {
     use c_str::CString;
-    use container::Container;
+    use core_collections::Collection;
     use intrinsics;
     use io::{IoResult, Writer};
     use libc;
index 61c26d4d8fd32712a0aa2c31e96a9a42f30847d7..bb5f020e78c9d9ac1d1bd78f805e15278575f580 100644 (file)
@@ -18,6 +18,6 @@ fn main() {
     let x: Box<HashMap<int, int>> = box HashMap::new();
     let x: Box<Map<int, int>> = x;
     let y: Box<Map<uint, int>> = box x;
-    //~^ ERROR failed to find an implementation of trait core::collections::Map<uint,int>
-    //         for ~core::collections::Map<int,int>:Send
+    //~^ ERROR failed to find an implementation of trait collections::Map<uint,int>
+    //         for ~collections::Map<int,int>:Send
 }