mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Move hashmap/hashset to toplevel
This commit is contained in:
parent
2b99611291
commit
46fbc1f014
6 changed files with 14 additions and 34 deletions
|
@ -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>;
|
||||
}
|
18
src/lib.rs
18
src/lib.rs
|
@ -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 {
|
||||
|
|
|
@ -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.
|
Loading…
Add table
Add a link
Reference in a new issue