Move hashmap/hashset to toplevel

This commit is contained in:
Manish Goregaokar 2017-08-25 16:24:41 -07:00
parent 2b99611291
commit 46fbc1f014
6 changed files with 14 additions and 34 deletions

View file

@ -1,24 +0,0 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Unordered containers, implemented as hash-tables
mod bench;
mod table;
pub mod map;
pub mod set;
trait Recover<Q: ?Sized> {
type Key;
fn get(&self, key: &Q) -> Option<&Self::Key>;
fn take(&mut self, key: &Q) -> Option<Self::Key>;
fn replace(&mut self, key: Self::Key) -> Option<Self::Key>;
}

View file

@ -6,15 +6,19 @@ extern crate alloc;
pub use std::*;
#[path="hash/mod.rs"]
mod impls;
mod bench;
mod table;
#[path="map.rs"]
pub mod hash_map;
#[path="set.rs"]
pub mod hash_set;
pub mod hash_map {
pub use super::impls::map::*;
}
trait Recover<Q: ?Sized> {
type Key;
pub mod hash_set {
pub use super::impls::set::*;
fn get(&self, key: &Q) -> Option<&Self::Key>;
fn take(&mut self, key: &Q) -> Option<Self::Key>;
fn replace(&mut self, key: Self::Key) -> Option<Self::Key>;
}
mod shim {

View file

@ -15,7 +15,7 @@ use iter::{Chain, FromIterator};
use ops::{BitOr, BitAnd, BitXor, Sub};
use super::Recover;
use super::map::{self, HashMap, Keys, RandomState};
use super::hash_map::{self, HashMap, Keys, RandomState};
// Future Optimization (FIXME!)
// =============================
@ -882,7 +882,7 @@ pub struct Iter<'a, K: 'a> {
/// [`HashSet`]: struct.HashSet.html
/// [`into_iter`]: struct.HashSet.html#method.into_iter
pub struct IntoIter<K> {
iter: map::IntoIter<K, ()>,
iter: hash_map::IntoIter<K, ()>,
}
/// A draining iterator over the items of a `HashSet`.
@ -893,7 +893,7 @@ pub struct IntoIter<K> {
/// [`HashSet`]: struct.HashSet.html
/// [`drain`]: struct.HashSet.html#method.drain
pub struct Drain<'a, K: 'static> {
iter: map::Drain<'a, K, ()>,
iter: hash_map::Drain<'a, K, ()>,
}
/// A lazy iterator producing elements in the intersection of `HashSet`s.