Skip to content

Commit

Permalink
Remove the bench feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrezot committed Jan 21, 2025
1 parent f76179a commit 8222ee5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ name = "cosmian_findex"
path = "src/lib.rs"

[features]
bench = []
redis-mem = ["redis"]
test-utils = []

Expand Down Expand Up @@ -53,8 +52,8 @@ tokio = { version = "1.38.0", features = [
[[bench]]
name = "benches"
harness = false
required-features = ["bench"]
required-features = ["test-utils"]

[[example]]
name = "insert"
required-features = ["bench"]
required-features = ["test-utils"]
4 changes: 3 additions & 1 deletion src/adt/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
mod interfaces;

pub use interfaces::{IndexADT, MemoryADT, VectorADT};

#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;

#[cfg(test)]
pub use interfaces::tests;
pub use interfaces::{IndexADT, MemoryADT, VectorADT};
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ pub use value::Value;
#[cfg(feature = "redis-mem")]
pub use memory::redis_store::{MemoryError, RedisMemory};

#[cfg(any(feature = "redis-mem", feature = "bench"))]
#[cfg(feature = "test-utils")]
pub use encoding::{WORD_LENGTH, dummy_decode, dummy_encode};
#[cfg(any(test, feature = "bench"))]

#[cfg(any(test, feature = "test-utils"))]
pub use memory::InMemory;

/// 16-byte addresses ensure a high collision resistance that poses virtually no limitation on the
Expand Down
4 changes: 1 addition & 3 deletions src/memory/in_memory_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ impl<Address: Hash + Eq + Debug, Value: Clone + Eq + Debug> Default for InMemory
}

impl<Address: Hash + Eq + Debug, Value: Clone + Eq + Debug> InMemory<Address, Value> {
#[cfg(feature = "bench")]
pub fn with_capacity(c: usize) -> Self {
Self {
inner: Arc::new(Mutex::new(HashMap::with_capacity(c))),
}
}

#[cfg(any(test, feature = "bench"))]
pub fn clear(&self) {
self.inner.lock().expect("poisoned lock").clear();
}
Expand Down Expand Up @@ -76,7 +74,6 @@ impl<Address: Send + Sync + Hash + Eq + Debug, Value: Send + Sync + Clone + Eq +
}
}

#[cfg(feature = "bench")]
impl<Address: Hash + Eq + Debug + Clone, Value: Clone + Eq + Debug> IntoIterator
for InMemory<Address, Value>
{
Expand All @@ -92,6 +89,7 @@ impl<Address: Hash + Eq + Debug + Clone, Value: Clone + Eq + Debug> IntoIterator
.into_iter()
}
}

#[cfg(test)]
mod tests {

Expand Down
4 changes: 3 additions & 1 deletion src/memory/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
mod encryption_layer;

#[cfg(any(test, feature = "test-utils"))]
mod in_memory_store;

pub use encryption_layer::MemoryEncryptionLayer;

#[cfg(feature = "redis-mem")]
pub mod redis_store;

#[cfg(any(test, feature = "bench"))]
#[cfg(any(test, feature = "test-utils"))]
pub use in_memory_store::InMemory;

0 comments on commit 8222ee5

Please sign in to comment.