Skip to content

Commit 2dd5b9d

Browse files
committed
Minor updates to docs, and changed to GitHub actions for CI.
1 parent acb517a commit 2dd5b9d

File tree

14 files changed

+142
-235
lines changed

14 files changed

+142
-235
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
tests:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Run tests
18+
run: cargo test
19+
benchmarks-and-checks:
20+
runs-on: ubuntu-latest
21+
defaults:
22+
run:
23+
working-directory: benches
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Check formatting
27+
run: cargo fmt --check
28+
- name: Run clippy
29+
run: cargo clippy --all-targets -- --deny warnings
30+
- name: Run benchmarks
31+
run: cargo bench

.travis.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

Cargo.toml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
[package]
2-
authors = ["Fraser Hutchison <fraser[email protected]>"]
2+
authors = ["Fraser Hutchison <fraser@astria.org>"]
33
categories = ["data-structures"]
44
description = "A hasher which is designed to work with already-hashed or hash-like data."
5+
documentation = "https://docs.rs/hash_hasher"
56
edition = "2018"
6-
keywords = ["hashmap", "hashset", "hasher", "hash", ]
7+
keywords = ["hashmap", "hashset", "hasher", "hash"]
78
license = "Apache-2.0 OR MIT"
89
name = "hash_hasher"
910
readme = "README.md"
1011
repository = "https://github.com/Fraser999/Hash-Hasher.git"
11-
version = "2.0.3"
12+
version = "2.0.4"
13+
14+
[badges.maintenance]
15+
status = "passively-maintained"
1216

1317
[dev-dependencies]
14-
rand = "0.7"
15-
fnv = "1"
18+
rand = "0.9.1"
19+
fnv = "1.0.7"

Hash-Hasher.code-workspace

Lines changed: 0 additions & 8 deletions
This file was deleted.

Hash-Hasher.sublime-project

Lines changed: 0 additions & 8 deletions
This file was deleted.

README.md

Lines changed: 54 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,91 @@
11
# hash_hasher
22

3-
A [`std::hash::Hasher`](https://doc.rust-lang.org/std/hash/trait.Hasher.html) which is designed to
4-
work with already-hashed or hash-like data.
3+
A [`std::hash::Hasher`](https://doc.rust-lang.org/std/hash/trait.Hasher.html)
4+
which is designed to work with already-hashed or hash-like data.
55

66
[![Documentation](https://docs.rs/hash_hasher/badge.svg)](https://docs.rs/hash_hasher)
7-
[![](http://meritbadge.herokuapp.com/hash_hasher)](https://crates.io/crates/hash_hasher)
8-
[![Build status](https://ci.appveyor.com/api/projects/status/cw65dk301auysvom/branch/master?svg=true)](https://ci.appveyor.com/project/Fraser999/hash-hasher/branch/master)
9-
[![Build Status](https://travis-ci.org/Fraser999/Hash-Hasher.svg?branch=master)](https://travis-ci.org/Fraser999/Hash-Hasher)
7+
[![Crates.io](https://img.shields.io/crates/v/hash_hasher.svg)](https://crates.io/crates/hash_hasher)
8+
[![Build Status](https://github.com/Fraser999/Hash-Hasher/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Fraser999/Hash-Hasher/actions/workflows/ci.yml)
109

1110
## Details
1211

13-
The provided hasher does minimal work under the assumption that the input data is already suitable
14-
for use as a key in a `HashSet` or `HashMap`.
12+
The provided hasher does minimal work under the assumption that the input data
13+
is already suitable for use as a key in a `HashSet` or `HashMap`.
1514

16-
As well as the performance benefit, it also causes `HashSet`s or `HashMap`s to become somewhat
17-
deterministic. Given two equal `HashSet`s or `HashMap`s containing more than a single element,
18-
iterating them will yield the elements in differing orders. By using a
19-
[`hash_hasher::HashedSet`](https://docs.rs/hash_hasher/*/hash_hasher/type.HashedSet.html) or
20-
[`hash_hasher::HashedMap`](https://docs.rs/hash_hasher/*/hash_hasher/type.HashedMap.html), then if
21-
the same data is inserted and/or removed *in the same order*, iterating the collection will yield a
22-
consistent order.
15+
As well as the performance benefit, it also causes `HashSet`s or `HashMap`s to
16+
become somewhat deterministic. Given two equal `HashSet`s or `HashMap`s
17+
containing more than a single element, iterating them will likely yield the
18+
elements in differing orders. By using a
19+
[`hash_hasher::HashedSet`](https://docs.rs/hash_hasher/*/hash_hasher/type.HashedSet.html)
20+
or
21+
[`hash_hasher::HashedMap`](https://docs.rs/hash_hasher/*/hash_hasher/type.HashedMap.html),
22+
then if the same data is inserted and/or removed *in the same order*, iterating
23+
the collection will yield a consistent order.
2324

2425
## Example
2526

26-
Since `new()` and `with_capacity()` aren't available for `HashSet`s or `HashMap`s using custom
27-
hashers, the available constructors are `default()`, `with_hasher()` and
28-
`with_capacity_and_hasher()`.
27+
Since `new()` and `with_capacity()` aren't available for `HashSet`s or
28+
`HashMap`s using custom hashers, the available constructors are `default()`,
29+
`with_hasher()` and `with_capacity_and_hasher()`.
2930

3031
```rust
31-
extern crate hash_hasher;
32-
3332
use hash_hasher::{HashBuildHasher, HashedMap, HashedSet};
3433

35-
let mut map = HashedMap::default();
34+
let mut map = HashedMap::default ();
3635
assert!(map.insert(0, "zero").is_none());
3736

38-
let mut set = HashedSet::with_capacity_and_hasher(100, HashBuildHasher::default());
37+
let mut set = HashedSet::with_capacity_and_hasher(100, HashBuildHasher::default ());
3938
assert!(set.insert(0));
4039
```
4140

4241
## Benchmarks
4342

44-
A benchmark suite is included and sample figures can be found at the end of the nightly jobs of the
45-
[AppVeyor results](https://ci.appveyor.com/project/Fraser999/hash-hasher/branch/master) and the
46-
[Travis results](https://travis-ci.org/Fraser999/Hash-Hasher).
43+
A benchmark suite is included and sample figures can be found in the
44+
[CI results](https://github.com/Fraser999/Hash-Hasher/actions/workflows/ci.yml)
45+
in the `benchmarks-and-checks` job under the `Run benchmarks` step.
4746

4847
For example:
4948

5049
```
51-
insert_sha1s_into_set_using_default_hasher ... bench: 1,171 ns/iter (+/- 30)
52-
insert_sha1s_into_set_using_hash_hasher ... bench: 533 ns/iter (+/- 9)
53-
54-
insert_sha256s_into_set_using_default_hasher ... bench: 1,340 ns/iter (+/- 57)
55-
insert_sha256s_into_set_using_hash_hasher ... bench: 546 ns/iter (+/- 11)
56-
57-
insert_sha512s_into_set_using_default_hasher ... bench: 1,804 ns/iter (+/- 2,597)
58-
insert_sha512s_into_set_using_hash_hasher ... bench: 704 ns/iter (+/- 22)
59-
60-
insert_sip_hashes_into_set_using_default_hasher ... bench: 781 ns/iter (+/- 33)
61-
insert_sip_hashes_into_set_using_hash_hasher ... bench: 256 ns/iter (+/- 50)
50+
test hash_sha1s_using_default_hasher ... bench: 191.12 ns/iter (+/- 17.41)
51+
test hash_sha1s_using_fnv_hasher ... bench: 196.12 ns/iter (+/- 3.09)
52+
test hash_sha1s_using_hash_hasher ... bench: 0.18 ns/iter (+/- 0.00)
53+
test hash_sha256s_using_default_hasher ... bench: 248.04 ns/iter (+/- 4.94)
54+
test hash_sha256s_using_fnv_hasher ... bench: 369.20 ns/iter (+/- 3.10)
55+
test hash_sha256s_using_hash_hasher ... bench: 0.18 ns/iter (+/- 0.00)
56+
test hash_sha512s_using_default_hasher ... bench: 263.13 ns/iter (+/- 0.30)
57+
test hash_sha512s_using_fnv_hasher ... bench: 1,058.13 ns/iter (+/- 3.17)
58+
test hash_sha512s_using_hash_hasher ... bench: 0.18 ns/iter (+/- 0.01)
59+
test hash_sip_hashes_using_default_hasher ... bench: 0.18 ns/iter (+/- 0.01)
60+
test hash_sip_hashes_using_fnv_hasher ... bench: 0.18 ns/iter (+/- 0.01)
61+
test hash_sip_hashes_using_hash_hasher ... bench: 0.18 ns/iter (+/- 0.01)
62+
test insert_sha1s_into_fnv_set ... bench: 281.13 ns/iter (+/- 5.70)
63+
test insert_sha1s_into_set_using_default_hasher ... bench: 381.28 ns/iter (+/- 9.83)
64+
test insert_sha1s_into_set_using_hash_hasher ... bench: 97.50 ns/iter (+/- 0.69)
65+
test insert_sha256s_into_set_using_default_hasher ... bench: 407.91 ns/iter (+/- 20.46)
66+
test insert_sha256s_into_set_using_fnv_hasher ... bench: 823.43 ns/iter (+/- 41.30)
67+
test insert_sha256s_into_set_using_hash_hasher ... bench: 90.92 ns/iter (+/- 0.89)
68+
test insert_sha512s_into_set_using_default_hasher ... bench: 541.99 ns/iter (+/- 18.94)
69+
test insert_sha512s_into_set_using_fnv_hasher ... bench: 1,338.65 ns/iter (+/- 47.01)
70+
test insert_sha512s_into_set_using_hash_hasher ... bench: 190.27 ns/iter (+/- 1.28)
71+
test insert_sip_hashes_into_set_using_default_hasher ... bench: 265.87 ns/iter (+/- 3.10)
72+
test insert_sip_hashes_into_set_using_fnv_hasher ... bench: 113.35 ns/iter (+/- 4.27)
73+
test insert_sip_hashes_into_set_using_hash_hasher ... bench: 55.40 ns/iter (+/- 0.16)
6274
```
6375

6476
## License
6577

6678
Licensed under either of
6779

68-
* [Apache License, Version 2.0](https://opensource.org/licenses/Apache-2.0) (see also [LICENSE-APACHE](LICENSE-APACHE))
69-
* [MIT License](https://opensource.org/licenses/MIT) (see also [LICENSE-MIT](LICENSE-MIT))
80+
* [Apache License, Version 2.0](https://opensource.org/licenses/Apache-2.0) (see
81+
also [LICENSE-APACHE](LICENSE-APACHE))
82+
* [MIT License](https://opensource.org/licenses/MIT) (see
83+
also [LICENSE-MIT](LICENSE-MIT))
7084

7185
at your option.
7286

7387
## Contribution
7488

75-
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the
76-
work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
77-
additional terms or conditions.
89+
Unless you explicitly state otherwise, any contribution intentionally submitted
90+
for inclusion in the work by you, as defined in the Apache-2.0 license, shall
91+
be dual licensed as above, without any additional terms or conditions.

appveyor.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

benches/lib.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,3 @@
1-
#![warn(unused, missing_copy_implementations, missing_docs)]
2-
#![deny(
3-
deprecated_in_future,
4-
future_incompatible,
5-
macro_use_extern_crate,
6-
rust_2018_idioms,
7-
nonstandard_style,
8-
single_use_lifetimes,
9-
trivial_casts,
10-
trivial_numeric_casts,
11-
unsafe_code,
12-
unused_import_braces,
13-
unused_lifetimes,
14-
unused_qualifications,
15-
unused_results,
16-
warnings,
17-
clippy::all,
18-
clippy::pedantic
19-
)]
20-
#![forbid(
21-
const_err,
22-
invalid_type_param_default,
23-
macro_expanded_macro_exports_accessed_by_absolute_paths,
24-
missing_fragment_specifier,
25-
mutable_transmutes,
26-
no_mangle_const_items,
27-
order_dependent_trait_objects,
28-
overflowing_literals,
29-
pub_use_of_private_extern_crate,
30-
unknown_crate_types
31-
)]
321
#![feature(test)]
332

343
extern crate test;

benches/rust-toolchain.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "nightly-2025-05-14"
3+
components = ["rustfmt", "clippy"]
4+
profile = "minimal"

0 commit comments

Comments
 (0)