Skip to content

Commit

Permalink
Implement RFC 580
Browse files Browse the repository at this point in the history
This commit implements RFC 580 by renaming:

* DList -> LinkedList
* Bitv -> BitVec
* BitvSet -> BitSet
* RingBuf -> VecDeque

More details are in [the
RFC](rust-lang/rfcs#580)

[breaking-change]
  • Loading branch information
aturon authored and Gankra committed Feb 18, 2015
1 parent dfc5c0f commit 5fa9de1
Show file tree
Hide file tree
Showing 12 changed files with 917 additions and 876 deletions.
1,046 changes: 527 additions & 519 deletions src/libcollections/bit.rs

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/libcollections/btree/map.rs
Expand Up @@ -29,7 +29,7 @@ use core::ops::{Index, IndexMut};
use core::{iter, fmt, mem};
use Bound::{self, Included, Excluded, Unbounded};

use ring_buf::RingBuf;
use vec_deque::VecDeque;

use self::Continuation::{Continue, Finished};
use self::StackOp::*;
Expand Down Expand Up @@ -75,7 +75,7 @@ pub struct BTreeMap<K, V> {

/// An abstract base over-which all other BTree iterators are built.
struct AbsIter<T> {
traversals: RingBuf<T>,
traversals: VecDeque<T>,
size: usize,
}

Expand Down Expand Up @@ -1189,7 +1189,7 @@ impl<K, V> BTreeMap<K, V> {
pub fn iter(&self) -> Iter<K, V> {
let len = self.len();
// NB. The initial capacity for ringbuf is large enough to avoid reallocs in many cases.
let mut lca = RingBuf::new();
let mut lca = VecDeque::new();
lca.push_back(Traverse::traverse(&self.root));
Iter {
inner: AbsIter {
Expand Down Expand Up @@ -1221,7 +1221,7 @@ impl<K, V> BTreeMap<K, V> {
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<K, V> {
let len = self.len();
let mut lca = RingBuf::new();
let mut lca = VecDeque::new();
lca.push_back(Traverse::traverse(&mut self.root));
IterMut {
inner: AbsIter {
Expand Down Expand Up @@ -1250,7 +1250,7 @@ impl<K, V> BTreeMap<K, V> {
#[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<K, V> {
let len = self.len();
let mut lca = RingBuf::new();
let mut lca = VecDeque::new();
lca.push_back(Traverse::traverse(self.root));
IntoIter {
inner: AbsIter {
Expand Down Expand Up @@ -1342,7 +1342,7 @@ macro_rules! range_impl {
// A deque that encodes two search paths containing (left-to-right):
// a series of truncated-from-the-left iterators, the LCA's doubly-truncated iterator,
// and a series of truncated-from-the-right iterators.
let mut traversals = RingBuf::new();
let mut traversals = VecDeque::new();
let (root, min, max) = ($root, $min, $max);

let mut leftmost = None;
Expand Down
44 changes: 34 additions & 10 deletions src/libcollections/lib.rs
Expand Up @@ -49,17 +49,33 @@ extern crate alloc;
#[cfg(test)] #[macro_use] extern crate log;

pub use binary_heap::BinaryHeap;
pub use bitv::Bitv;
pub use bitv_set::BitvSet;
pub use bit_vec::BitVec;
pub use bit_set::BitSet;
pub use btree_map::BTreeMap;
pub use btree_set::BTreeSet;
pub use dlist::DList;
pub use linked_list::LinkedList;
pub use enum_set::EnumSet;
pub use ring_buf::RingBuf;
pub use vec_deque::VecDeque;
pub use string::String;
pub use vec::Vec;
pub use vec_map::VecMap;

#[deprecated(since = "1.0.0", reason = "renamed to vec_deque")]
#[unstable(feature = "collections")]
pub use vec_deque as ring_buf;

#[deprecated(since = "1.0.0", reason = "renamed to linked_list")]
#[unstable(feature = "collections")]
pub use linked_list as dlist;

#[deprecated(since = "1.0.0", reason = "renamed to bit_vec")]
#[unstable(feature = "collections")]
pub use bit_vec as bitv;

#[deprecated(since = "1.0.0", reason = "renamed to bit_set")]
#[unstable(feature = "collections")]
pub use bit_set as bitv_set;

// Needed for the vec! macro
pub use alloc::boxed;

Expand All @@ -71,10 +87,10 @@ mod macros;
pub mod binary_heap;
mod bit;
mod btree;
pub mod dlist;
pub mod linked_list;
pub mod enum_set;
pub mod fmt;
pub mod ring_buf;
pub mod vec_deque;
pub mod slice;
pub mod str;
pub mod string;
Expand All @@ -83,15 +99,23 @@ pub mod vec_map;

#[unstable(feature = "collections",
reason = "RFC 509")]
pub mod bitv {
pub use bit::{Bitv, Iter};
pub mod bit_vec {
pub use bit::{BitVec, Iter};

#[deprecated(since = "1.0.0", reason = "renamed to BitVec")]
#[unstable(feature = "collections")]
pub use bit::BitVec as Bitv;
}

#[unstable(feature = "collections",
reason = "RFC 509")]
pub mod bitv_set {
pub use bit::{BitvSet, Union, Intersection, Difference, SymmetricDifference};
pub mod bit_set {
pub use bit::{BitSet, Union, Intersection, Difference, SymmetricDifference};
pub use bit::SetIter as Iter;

#[deprecated(since = "1.0.0", reason = "renamed to BitSet")]
#[unstable(feature = "collections")]
pub use bit::BitSet as BitvSet;
}

#[stable(feature = "rust1", since = "1.0.0")]
Expand Down

0 comments on commit 5fa9de1

Please sign in to comment.