Skip to content

Implement RFC 580 #22483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading