Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ef112fe

Browse files
committedSep 27, 2014
auto merge of #17334 : Gankro/rust/btree-vec, r=huonw
Replaces BTree with BTreeMap and BTreeSet, which are completely new implementations. BTreeMap's internal Node representation is particularly inefficient at the moment to make this first implementation easy to reason about and fairly safe. Both collections are also currently missing some of the tooling specific to sorted collections, which is planned as future work pending reform of these APIs. General implementation issues are discussed with TODOs internally [breaking-change] Still waiting on compilation/test/bench stuff locally, but the edit-distance on any errors should be very small at this point. This is ready to be reviewed.
2 parents 34dfa45 + b6edc59 commit ef112fe

File tree

7 files changed

+2222
-921
lines changed

7 files changed

+2222
-921
lines changed
 

‎src/libcollections/btree.rs

Lines changed: 0 additions & 919 deletions
This file was deleted.

‎src/libcollections/btree/map.rs

Lines changed: 1203 additions & 0 deletions
Large diffs are not rendered by default.

‎src/libcollections/btree/mod.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 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+
pub use self::map::BTreeMap;
12+
pub use self::map::Entries;
13+
pub use self::map::MutEntries;
14+
pub use self::map::MoveEntries;
15+
pub use self::map::Keys;
16+
pub use self::map::Values;
17+
pub use self::map::Entry;
18+
pub use self::map::OccupiedEntry;
19+
pub use self::map::VacantEntry;
20+
21+
pub use self::set::BTreeSet;
22+
pub use self::set::Items;
23+
pub use self::set::MoveItems;
24+
pub use self::set::DifferenceItems;
25+
pub use self::set::UnionItems;
26+
pub use self::set::SymDifferenceItems;
27+
pub use self::set::IntersectionItems;
28+
29+
30+
mod node;
31+
mod map;
32+
mod set;

‎src/libcollections/btree/node.rs

Lines changed: 552 additions & 0 deletions
Large diffs are not rendered by default.

‎src/libcollections/btree/set.rs

Lines changed: 433 additions & 0 deletions
Large diffs are not rendered by default.

‎src/libcollections/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern crate alloc;
3737
use core::prelude::Option;
3838

3939
pub use bitv::{Bitv, BitvSet};
40-
pub use btree::BTree;
40+
pub use btree::{BTreeMap, BTreeSet};
4141
pub use core::prelude::Collection;
4242
pub use dlist::DList;
4343
pub use enum_set::EnumSet;

‎src/libstd/collections/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
pub use core_collections::{Collection, Mutable, Map, MutableMap};
1818
pub use core_collections::{Set, MutableSet, Deque, MutableSeq};
19-
pub use core_collections::{Bitv, BitvSet, BTree, DList, EnumSet};
19+
pub use core_collections::{Bitv, BitvSet, BTreeMap, BTreeSet, DList, EnumSet};
2020
pub use core_collections::{PriorityQueue, RingBuf, SmallIntMap};
2121
pub use core_collections::{TreeMap, TreeSet, TrieMap, TrieSet};
2222
pub use core_collections::{bitv, btree, dlist, enum_set};

0 commit comments

Comments
 (0)
Please sign in to comment.