diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2014-03-08 18:11:52 -0500 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2014-03-20 01:30:27 -0400 |
| commit | ce620320a20baa1428e679c751b1b4a8d8556ca1 (patch) | |
| tree | f28a0234fe5f1d9509ef6cfa0c92448f7f29f7ec /src/libcollections | |
| parent | 4ca51aeea7187a63b987129d67cf7d348b6c60a9 (diff) | |
rename std::vec -> std::slice
Closes #12702
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/bitv.rs | 22 | ||||
| -rw-r--r-- | src/libcollections/deque.rs | 4 | ||||
| -rw-r--r-- | src/libcollections/hashmap.rs | 4 | ||||
| -rw-r--r-- | src/libcollections/priority_queue.rs | 4 | ||||
| -rw-r--r-- | src/libcollections/ringbuf.rs | 4 | ||||
| -rw-r--r-- | src/libcollections/smallintmap.rs | 8 | ||||
| -rw-r--r-- | src/libcollections/trie.rs | 8 |
7 files changed, 27 insertions, 27 deletions
diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs index 87e9c3f238a..7075e47bddf 100644 --- a/src/libcollections/bitv.rs +++ b/src/libcollections/bitv.rs @@ -16,7 +16,7 @@ use std::iter::RandomAccessIterator; use std::iter::{Rev, Enumerate, Repeat, Map, Zip}; use std::ops; use std::uint; -use std::vec; +use std::slice; #[deriving(Clone)] struct SmallBitv { @@ -278,13 +278,13 @@ impl Bitv { let s = if init { if exact { - vec::from_elem(nelems, !0u) + slice::from_elem(nelems, !0u) } else { - let mut v = vec::from_elem(nelems-1, !0u); + let mut v = slice::from_elem(nelems-1, !0u); v.push((1<<nbits % uint::BITS)-1); v } - } else { vec::from_elem(nelems, 0u)}; + } else { slice::from_elem(nelems, 0u)}; Big(BigBitv::new(s)) }; Bitv {rep: rep, nbits: nbits} @@ -452,7 +452,7 @@ impl Bitv { * Each `uint` in the resulting vector has either value `0u` or `1u`. */ pub fn to_vec(&self) -> ~[uint] { - vec::from_fn(self.nbits, |x| self.init_to_vec(x)) + slice::from_fn(self.nbits, |x| self.init_to_vec(x)) } /** @@ -473,7 +473,7 @@ impl Bitv { let len = self.nbits/8 + if self.nbits % 8 == 0 { 0 } else { 1 }; - vec::from_fn(len, |i| + slice::from_fn(len, |i| bit(self, i, 0) | bit(self, i, 1) | bit(self, i, 2) | @@ -489,7 +489,7 @@ impl Bitv { * Transform `self` into a `[bool]` by turning each bit into a `bool`. */ pub fn to_bools(&self) -> ~[bool] { - vec::from_fn(self.nbits, |i| self[i]) + slice::from_fn(self.nbits, |i| self[i]) } /** @@ -879,7 +879,7 @@ impl BitvSet { /// and w1/w2 are the words coming from the two vectors self, other. fn commons<'a>(&'a self, other: &'a BitvSet) -> Map<'static, ((uint, &'a uint), &'a ~[uint]), (uint, uint, uint), - Zip<Enumerate<vec::Items<'a, uint>>, Repeat<&'a ~[uint]>>> { + Zip<Enumerate<slice::Items<'a, uint>>, Repeat<&'a ~[uint]>>> { let min = cmp::min(self.bitv.storage.len(), other.bitv.storage.len()); self.bitv.storage.slice(0, min).iter().enumerate() .zip(Repeat::new(&other.bitv.storage)) @@ -895,7 +895,7 @@ impl BitvSet { /// `other`. fn outliers<'a>(&'a self, other: &'a BitvSet) -> Map<'static, ((uint, &'a uint), uint), (bool, uint, uint), - Zip<Enumerate<vec::Items<'a, uint>>, Repeat<uint>>> { + Zip<Enumerate<slice::Items<'a, uint>>, Repeat<uint>>> { let slen = self.bitv.storage.len(); let olen = other.bitv.storage.len(); @@ -946,7 +946,7 @@ mod tests { use bitv; use std::uint; - use std::vec; + use std::slice; use rand; use rand::Rng; @@ -964,7 +964,7 @@ mod tests { #[test] fn test_0_elements() { let act = Bitv::new(0u, false); - let exp = vec::from_elem::<bool>(0u, false); + let exp = slice::from_elem::<bool>(0u, false); assert!(act.eq_vec(exp)); } diff --git a/src/libcollections/deque.rs b/src/libcollections/deque.rs index f84354f9b00..05df04d293f 100644 --- a/src/libcollections/deque.rs +++ b/src/libcollections/deque.rs @@ -44,7 +44,7 @@ pub mod bench { extern crate test; use self::test::BenchHarness; use std::container::MutableMap; - use std::vec; + use std::slice; use rand; use rand::Rng; @@ -90,7 +90,7 @@ pub mod bench { bh: &mut BenchHarness) { // setup let mut rng = rand::XorShiftRng::new(); - let mut keys = vec::from_fn(n, |_| rng.gen::<uint>() % n); + let mut keys = slice::from_fn(n, |_| rng.gen::<uint>() % n); for k in keys.iter() { map.insert(*k, 1); diff --git a/src/libcollections/hashmap.rs b/src/libcollections/hashmap.rs index 46d3ab432cd..ba87e2106e4 100644 --- a/src/libcollections/hashmap.rs +++ b/src/libcollections/hashmap.rs @@ -27,7 +27,7 @@ use std::option::{Option, Some, None}; use rand; use rand::Rng; use std::result::{Ok, Err}; -use std::vec::{ImmutableVector}; +use std::slice::ImmutableVector; mod table { use std::clone::Clone; @@ -1958,7 +1958,7 @@ mod test_map { mod test_set { use super::HashSet; use std::container::Container; - use std::vec::ImmutableEqVector; + use std::slice::ImmutableEqVector; #[test] fn test_disjoint() { diff --git a/src/libcollections/priority_queue.rs b/src/libcollections/priority_queue.rs index 5463d267787..dc9e5a9700d 100644 --- a/src/libcollections/priority_queue.rs +++ b/src/libcollections/priority_queue.rs @@ -14,7 +14,7 @@ use std::clone::Clone; use std::mem::{move_val_init, init, replace, swap}; -use std::vec; +use std::slice; /// A priority queue implemented with a binary heap #[deriving(Clone)] @@ -181,7 +181,7 @@ impl<T:Ord> PriorityQueue<T> { /// PriorityQueue iterator pub struct Items <'a, T> { - priv iter: vec::Items<'a, T>, + priv iter: slice::Items<'a, T>, } impl<'a, T> Iterator<&'a T> for Items<'a, T> { diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs index e09bf1023d6..e083f3f600f 100644 --- a/src/libcollections/ringbuf.rs +++ b/src/libcollections/ringbuf.rs @@ -14,7 +14,7 @@ //! extra::container::Deque`. use std::cmp; -use std::vec; +use std::slice; use std::iter::{Rev, RandomAccessIterator}; use deque::Deque; @@ -118,7 +118,7 @@ impl<T> RingBuf<T> { /// Create an empty RingBuf with space for at least `n` elements. pub fn with_capacity(n: uint) -> RingBuf<T> { RingBuf{nelts: 0, lo: 0, - elts: vec::from_fn(cmp::max(MINIMUM_CAPACITY, n), |_| None)} + elts: slice::from_fn(cmp::max(MINIMUM_CAPACITY, n), |_| None)} } /// Retrieve an element in the RingBuf by index diff --git a/src/libcollections/smallintmap.rs b/src/libcollections/smallintmap.rs index 603d5bb820d..64be1b92e26 100644 --- a/src/libcollections/smallintmap.rs +++ b/src/libcollections/smallintmap.rs @@ -17,7 +17,7 @@ use std::iter::{Enumerate, FilterMap, Rev}; use std::mem::replace; -use std::vec; +use std::slice; #[allow(missing_doc)] pub struct SmallIntMap<T> { @@ -153,7 +153,7 @@ impl<V> SmallIntMap<V> { /// Empties the hash map, moving all values into the specified closure pub fn move_iter(&mut self) -> FilterMap<(uint, Option<V>), (uint, V), - Enumerate<vec::MoveItems<Option<V>>>> + Enumerate<slice::MoveItems<Option<V>>>> { let values = replace(&mut self.v, ~[]); values.move_iter().enumerate().filter_map(|(i, v)| { @@ -236,7 +236,7 @@ macro_rules! double_ended_iterator { pub struct Entries<'a, T> { priv front: uint, priv back: uint, - priv iter: vec::Items<'a, Option<T>> + priv iter: slice::Items<'a, Option<T>> } iterator!(impl Entries -> (uint, &'a T), get_ref) @@ -246,7 +246,7 @@ pub type RevEntries<'a, T> = Rev<Entries<'a, T>>; pub struct MutEntries<'a, T> { priv front: uint, priv back: uint, - priv iter: vec::MutItems<'a, Option<T>> + priv iter: slice::MutItems<'a, Option<T>> } iterator!(impl MutEntries -> (uint, &'a mut T), get_mut_ref) diff --git a/src/libcollections/trie.rs b/src/libcollections/trie.rs index 2232af98eb3..66bcd3cbdda 100644 --- a/src/libcollections/trie.rs +++ b/src/libcollections/trie.rs @@ -13,8 +13,8 @@ use std::mem; use std::uint; use std::mem::init; -use std::vec; -use std::vec::{Items, MutItems}; +use std::slice; +use std::slice::{Items, MutItems}; // FIXME: #5244: need to manually update the TrieNode constructor static SHIFT: uint = 4; @@ -474,7 +474,7 @@ fn remove<T>(count: &mut uint, child: &mut Child<T>, key: uint, /// Forward iterator over a map pub struct Entries<'a, T> { - priv stack: [vec::Items<'a, Child<T>>, .. NUM_CHUNKS], + priv stack: [slice::Items<'a, Child<T>>, .. NUM_CHUNKS], priv length: uint, priv remaining_min: uint, priv remaining_max: uint @@ -483,7 +483,7 @@ pub struct Entries<'a, T> { /// Forward iterator over the key-value pairs of a map, with the /// values being mutable. pub struct MutEntries<'a, T> { - priv stack: [vec::MutItems<'a, Child<T>>, .. NUM_CHUNKS], + priv stack: [slice::MutItems<'a, Child<T>>, .. NUM_CHUNKS], priv length: uint, priv remaining_min: uint, priv remaining_max: uint |
