Skip to content

Commit 973e348

Browse files
Merge #120
120: clean up and prepare 0.7 release r=crepererum a=crepererum Co-authored-by: Marco Neumann <marco@crepererum.net>
2 parents 67f4309 + 3b72b36 commit 973e348

File tree

12 files changed

+129
-100
lines changed

12 files changed

+129
-100
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## 0.7 --- Misc Improvements & Fixes
4+
5+
### All
6+
- support `?Sized` where possible
7+
- implement `Send` where possible
8+
9+
### Filters
10+
- proper union support
11+
12+
### HyperLogLog
13+
- fix potential out-of-bounds access (#74)
14+
- improve performance
15+
16+
### T-Digest
17+
- more scale functions
18+
19+
### Dependencies
20+
- replace `Void` with `Infallible`
21+
- update dependencies
22+
- make all dependencies optional
23+
324
## 0.6 --- T-Digest, Lossy Counter
425

526
### T-Digest

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# pdatastructs
22

3-
Simple probabilistic data structures
3+
A collection of data structures that are based probability theory and therefore only provide the correct answer if a
4+
certain probability. In exchange they have a better runtime and memory complexity compared to traditional data structures.
45

56
[![Build Status](https://github.com/crepererum/pdatastructs.rs/workflows/CI/badge.svg)](https://github.com/crepererum/pdatastructs.rs/actions?query=workflow%3ACI)
67
[![Crates.io](https://img.shields.io/crates/v/pdatastructs.svg)](https://crates.io/crates/pdatastructs)
@@ -25,8 +26,8 @@ The following data structures are implemented:
2526

2627
Licensed under either of these:
2728

28-
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
29-
* MIT License ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)
29+
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or <https://www.apache.org/licenses/LICENSE-2.0>)
30+
* MIT License ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/licenses/MIT>)
3031

3132
### Contributing
3233

src/countminsketch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ where
203203

204204
let w = (f64::consts::E / epsilon).ceil() as usize;
205205
let d = (1. / delta).ln().ceil() as usize;
206-
CountMinSketch::with_params_and_hasher(w, d, buildhasher)
206+
Self::with_params_and_hasher(w, d, buildhasher)
207207
}
208208

209209
/// Get number of columns of internal counter table.
@@ -302,7 +302,7 @@ impl<T> fmt::Debug for CountMinSketch<T>
302302
where
303303
T: Hash + ?Sized,
304304
{
305-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
305+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
306306
write!(f, "CountMinSketch {{ w: {}, d: {} }}", self.w, self.d)
307307
}
308308
}

src/filters/bloomfilter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ where
220220
let ln2 = (2f64).ln();
221221
let m = (-((n as f64) * p.ln()) / (ln2 * ln2)) as usize;
222222

223-
BloomFilter::with_params_and_hash(m, k, buildhasher)
223+
Self::with_params_and_hash(m, k, buildhasher)
224224
}
225225

226226
/// Get `k` (number of hash functions).
@@ -318,7 +318,7 @@ impl<T> fmt::Debug for BloomFilter<T>
318318
where
319319
T: Hash + ?Sized,
320320
{
321-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
321+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
322322
write!(f, "BloomFilter {{ m: {}, k: {} }}", self.bs.len(), self.k)
323323
}
324324
}

src/filters/cuckoofilter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const MAX_NUM_KICKS: usize = 500; // mentioned in paper
1414

1515
/// Error struct used to signal that a `CuckooFilter` is full, i.e. that a value cannot be inserted
1616
/// because the implementation was unable to find a free bucket.
17-
#[derive(Debug)]
17+
#[derive(Debug, Clone, Copy)]
1818
pub struct CuckooFilterFull;
1919

2020
/// A CuckooFilter is a set-like data structure, that keeps track of elements it has seen without
@@ -587,7 +587,7 @@ where
587587
R: Rng,
588588
B: BuildHasher + Clone + Eq,
589589
{
590-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
590+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
591591
write!(
592592
f,
593593
"CuckooFilter {{ bucketsize: {}, n_buckets: {} }}",

src/filters/quotientfilter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::filters::Filter;
1111
use crate::helpers::all_zero_intvector;
1212

1313
/// Error that signals that the QuotientFilter is full.
14-
#[derive(Debug)]
14+
#[derive(Debug, Clone, Copy)]
1515
pub struct QuotientFilterFull;
1616

1717
/// Internal results for scanning the quotientfilter.
@@ -282,7 +282,7 @@ where
282282
/// and a default hasher.
283283
pub fn with_params(bits_quotient: usize, bits_remainder: usize) -> Self {
284284
let buildhasher = BuildHasherDefault::<DefaultHasher>::default();
285-
QuotientFilter::with_params_and_hash(bits_quotient, bits_remainder, buildhasher)
285+
Self::with_params_and_hash(bits_quotient, bits_remainder, buildhasher)
286286
}
287287
}
288288

src/hash_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ where
105105
///
106106
/// This call is CPU-expensive and may only be used if the resulting iterator will really be
107107
/// used.
108-
pub fn iter_for<T>(&self, obj: &T) -> HashIter<B>
108+
pub fn iter_for<T>(&self, obj: &T) -> HashIter<'_, B>
109109
where
110110
T: Hash + ?Sized,
111111
{
@@ -141,7 +141,7 @@ where
141141
#[derive(Debug)]
142142
pub struct HashIter<'a, B>
143143
where
144-
B: 'a + BuildHasher,
144+
B: BuildHasher,
145145
{
146146
builder: &'a HashIterBuilder<B>,
147147
h1: u64,
@@ -191,7 +191,7 @@ where
191191
}
192192

193193
/// BuildHasher that takes a seed.
194-
#[derive(Clone, Debug, PartialEq, Eq)]
194+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
195195
pub struct BuildHasherSeeded {
196196
seed: usize,
197197
}

src/hyperloglog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl<T> fmt::Debug for HyperLogLog<T>
332332
where
333333
T: Hash + ?Sized,
334334
{
335-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
335+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
336336
write!(f, "HyperLogLog {{ b: {} }}", self.b)
337337
}
338338
}

src/lib.rs

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
1-
//! A collection of data structures that are based probability theory and therefore only provide
2-
//! the correct answer if a certain probability. In exchange they have a better runtime and memory
3-
//! complexity compared to traditional data structures.
4-
5-
#![deny(const_err)]
6-
#![deny(anonymous_parameters)]
7-
#![deny(bare_trait_objects)]
8-
#![deny(dead_code)]
9-
#![deny(illegal_floating_point_literal_pattern)]
10-
#![deny(missing_debug_implementations)]
11-
#![deny(missing_docs)]
12-
#![deny(non_camel_case_types)]
13-
#![deny(non_snake_case)]
14-
#![deny(non_upper_case_globals)]
15-
#![deny(unknown_lints)]
16-
#![deny(unreachable_code)]
17-
#![deny(unreachable_patterns)]
18-
#![deny(unreachable_pub)]
19-
#![deny(unsafe_code)]
20-
#![deny(unused_extern_crates)]
1+
#![doc = concat!(include_str!("../README.md"), "\n\n", include_str!("../CHANGELOG.md"))]
2+
#![deny(
3+
anonymous_parameters,
4+
bare_trait_objects,
5+
clippy::clone_on_ref_ptr,
6+
clippy::explicit_iter_loop,
7+
clippy::future_not_send,
8+
clippy::use_self,
9+
const_err,
10+
dead_code,
11+
illegal_floating_point_literal_pattern,
12+
missing_copy_implementations,
13+
missing_debug_implementations,
14+
missing_docs,
15+
non_camel_case_types,
16+
non_snake_case,
17+
non_upper_case_globals,
18+
rust_2018_idioms,
19+
rustdoc::bare_urls,
20+
rustdoc::broken_intra_doc_links,
21+
unknown_lints,
22+
unreachable_code,
23+
unreachable_patterns,
24+
unreachable_pub,
25+
unsafe_code,
26+
unused_extern_crates
27+
)]
2128

2229
#[cfg(feature = "num-traits")]
2330
pub use num_traits;

src/reservoirsampling.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<T, R> fmt::Debug for ReservoirSampling<T, R>
148148
where
149149
R: Rng,
150150
{
151-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
151+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
152152
write!(f, "ReservoirSampling {{ k: {} }}", self.k)
153153
}
154154
}

0 commit comments

Comments
 (0)