Skip to content
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
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ stages:
jobs:
- template: default.yml@templates
parameters:
minrust: 1.40.0
minrust: 1.48.0
codecov_token: $(CODECOV_TOKEN_SECRET)
dir: "evmap"
- job: benchmark
Expand Down
6 changes: 4 additions & 2 deletions evmap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ maintenance = { status = "passively-maintained" }
default = []
indexed = ["indexmap"]
eviction = ["indexed", "rand"]
amortize = ["indexmap-amortized", "hashbag/amortize"]

[dependencies]
indexmap = { version = "1.1.0", optional = true }
indexmap = { version = "1.6.1", optional = true }
indexmap-amortized = { version = "1.6.1", optional = true }
smallvec = "1.0.0"
hashbag = "0.1.2"
hashbag = "0.1.3"
rand = { version = "0.7", default-features = false, features = ["alloc"], optional = true }
left-right = { version = "0.11.0" } #, path = "../left-right", }

Expand Down
10 changes: 6 additions & 4 deletions evmap/src/inner.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use std::fmt;
use std::hash::{BuildHasher, Hash};

#[cfg(feature = "indexed")]
pub(crate) use indexmap::IndexMap as MapImpl;
#[cfg(not(feature = "indexed"))]
pub(crate) use std::collections::HashMap as MapImpl;
#[cfg(all(feature = "indexed", not(feature = "amortize")))]
pub(crate) use indexmap::{map::Entry, IndexMap as MapImpl};
#[cfg(feature = "amortize")]
pub(crate) use indexmap_amortized::{map::Entry, IndexMap as MapImpl};
#[cfg(not(any(feature = "indexed", feature = "amortize")))]
pub(crate) use std::collections::{hash_map::Entry, HashMap as MapImpl};

use crate::values::ValuesInner;
use left_right::aliasing::DropBehavior;
Expand Down
10 changes: 10 additions & 0 deletions evmap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
//! meta will also be made visible to readers. This could be useful, for example, to indicate what
//! time the refresh happened.
//!
//! # Features
//!
//! - `eviction`: Gives you access to [`WriteHandle::empty_random`] to empty out randomly chosen
//! keys from the map.
//! - `amortize`: Amortizes the cost of resizes in the underlying data structures. See
//! [`griddle`](https://github.com/jonhoo/griddle/) and
//! [`atone`](https://github.com/jonhoo/atone/) for details. This requires a nightly compiler
//! [for the time being](https://docs.rs/indexmap-amortized/1.0/indexmap_amortized/#rust-version).
//!
//!
//! # Examples
//!
//! Single-reader, single-writer
Expand Down
7 changes: 1 addition & 6 deletions evmap/src/write.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::inner::Inner;
use crate::inner::{Entry, Inner};
use crate::read::ReadHandle;
use crate::values::ValuesInner;
use left_right::{aliasing::Aliased, Absorb};
Expand All @@ -7,11 +7,6 @@ use std::collections::hash_map::RandomState;
use std::fmt;
use std::hash::{BuildHasher, Hash};

#[cfg(feature = "indexed")]
use indexmap::map::Entry;
#[cfg(not(feature = "indexed"))]
use std::collections::hash_map::Entry;

/// A handle that may be used to modify the eventually consistent map.
///
/// Note that any changes made to the map will not be made visible to readers until
Expand Down