Skip to content

Commit

Permalink
Merge pull request #126 from xacrimon/acrimon/fci
Browse files Browse the repository at this point in the history
v4 "The maintenance release"
  • Loading branch information
xacrimon authored Dec 25, 2020
2 parents 277436b + 7a132a2 commit 63f8e06
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 261 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ jobs:
i686-unknown-linux-gnu,
aarch64-unknown-linux-gnu,
armv7-linux-androideabi,
powerpc-unknown-linux-gnu,
wasm32-unknown-emscripten
powerpc-unknown-linux-gnu
]
steps:
- uses: actions/checkout@v2
Expand Down
7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dashmap"
version = "3.11.10"
version = "4.0.0"
authors = ["Acrimon <[email protected]>"]
edition = "2018"
license = "MIT"
Expand All @@ -15,14 +15,11 @@ categories = ["concurrency", "algorithms", "data-structures"]
[features]
default = []
raw-api = []
no_std = ["hashbrown"]

[dependencies]
num_cpus = "1.13.0"
ahash = "0.3.8"
serde = { version = "1.0.114", optional = true, features = ["derive"] }
serde = { version = "1.0.118", optional = true, features = ["derive"] }
cfg-if = "1.0.0"
hashbrown = { version = "0.8.0", optional = true }
rayon = { version = "1.5.0", optional = true }

[package.metadata.docs.rs]
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ If you have any suggestions or tips do not hesitate to open an issue or a PR.

## Cargo features

- `no_std` - Enable no_std + alloc support.

- `serde` - Enables serde support.

- `raw-api` - Enables the unstable raw-shard api.

- `rayon` - Enables rayon support.

## Support me

[![Foo](https://c5.patreon.com/external/logo/[email protected])](https://patreon.com/acrimon)
Expand All @@ -47,6 +47,9 @@ Do not hesitate to open issues or PR's.

I will take a look as soon as I have time for it.

That said I do not get paid (yet) to work on open-source. This means
that my time is limited and my work here comes after my personal life.

## Performance

A comprehensive benchmark suite including DashMap can be found [here](https://github.com/xacrimon/conc-map-bench).
Expand Down
22 changes: 3 additions & 19 deletions src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,11 @@ use crate::lock::{RwLockReadGuard, RwLockWriteGuard};
use crate::t::Map;
use crate::util::SharedValue;
use crate::{DashMap, HashMap};
use ahash::RandomState;
use core::hash::{BuildHasher, Hash};
use core::mem;

cfg_if::cfg_if! {
if #[cfg(feature = "no_std")] {
use alloc::sync::Arc;
use hashbrown::hash_map;
} else {
use std::sync::Arc;
use std::collections::hash_map;
}
}
use std::collections::hash_map;
use std::collections::hash_map::RandomState;
use std::sync::Arc;

/// Iterator over a DashMap yielding key value pairs.
///
Expand All @@ -31,7 +23,6 @@ cfg_if::cfg_if! {
/// let pairs: Vec<(&'static str, &'static str)> = map.into_iter().collect();
/// assert_eq!(pairs.len(), 2);
/// ```
pub struct OwningIter<K, V, S = RandomState> {
map: DashMap<K, V, S>,
shard_i: usize,
Expand Down Expand Up @@ -121,7 +112,6 @@ type GuardIterMut<'a, K, V, S> = (
/// map.insert("hello", "world");
/// assert_eq!(map.iter().count(), 1);
/// ```
pub struct Iter<'a, K, V, S = RandomState, M = DashMap<K, V, S>> {
map: &'a M,
shard_i: usize,
Expand Down Expand Up @@ -200,7 +190,6 @@ impl<'a, K: Eq + Hash, V, S: 'a + BuildHasher + Clone, M: Map<'a, K, V, S>> Iter
/// map.iter_mut().for_each(|mut r| *r += 1);
/// assert_eq!(*map.get("Johnny").unwrap(), 22);
/// ```
pub struct IterMut<'a, K, V, S = RandomState, M = DashMap<K, V, S>> {
map: &'a M,
shard_i: usize,
Expand Down Expand Up @@ -276,13 +265,10 @@ impl<'a, K: Eq + Hash, V, S: 'a + BuildHasher + Clone, M: Map<'a, K, V, S>> Iter
}

#[cfg(test)]

mod tests {

use crate::DashMap;

#[test]

fn iter_mut_manual_count() {
let map = DashMap::new();

Expand All @@ -300,7 +286,6 @@ mod tests {
}

#[test]

fn iter_mut_count() {
let map = DashMap::new();

Expand All @@ -312,7 +297,6 @@ mod tests {
}

#[test]

fn iter_count() {
let map = DashMap::new();

Expand Down
Loading

0 comments on commit 63f8e06

Please sign in to comment.