axhash-map 0.1.4

High-performance HashMap and HashSet backed by hashbrown (SwissTable) and fueled by axhash.
Documentation
# axhash-map

High-performance `HashMap` and `HashSet` for Rust powered by `hashbrown` and `axhash`.

- SwissTable-based layout via `hashbrown`
- AES-accelerated hashing
- Fast drop-in replacement for standard hash collections
- Serde-friendly type aliases
- Deterministic hashing by default

[![Crates.io](https://img.shields.io/crates/v/axhash-map.svg)](https://crates.io/crates/axhash-map)
[![Docs.rs](https://docs.rs/axhash-map/badge.svg)](https://docs.rs/axhash-map)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

---

## Installation

```toml
[dependencies]
axhash-map = "0.1"
```

AES acceleration is selected automatically at runtime.

---

## Usage

### Type alias (`HashMap` / `HashSet`)

Best for Serde and drop-in compatibility.

```rust
use axhash_map::HashMap;

let mut map: HashMap<&str, u32> = HashMap::default();

map.insert("alice", 42);
map.insert("bob", 17);

assert_eq!(map["alice"], 42);
```

---

### Branded types (`AxHashMap` / `AxHashSet`)

Provides convenient constructors like `new()` and `with_capacity()`.

```rust
use axhash_map::AxHashMap;

let mut map: AxHashMap<&str, u32> = AxHashMap::new();

map.insert("fast", 1);

assert_eq!(map.get("fast"), Some(&1));
```

---

## HashSet

```rust
use axhash_map::AxHashSet;

let mut set: AxHashSet<u64> = AxHashSet::new();

set.insert(1);
set.insert(2);
set.insert(2);

assert_eq!(set.len(), 2);
assert!(set.contains(&1));
```

---

## Constructors

```rust
use axhash_map::{
    AxHashMap,
    AxHashSet,
    AxBuildHasher,
};

let map = AxHashMap::<String, i32>::new();

let map =
    AxHashMap::<String, i32>::with_capacity(10_000);

let seed = 0xdeadbeef_cafebabe;

let map: AxHashMap<String, i32, AxBuildHasher> =
    AxHashMap::with_hasher(
        AxBuildHasher::with_seed(seed)
    );
```

---

## Entry API

```rust
use axhash_map::AxHashMap;

let mut map: AxHashMap<&str, u32> = AxHashMap::new();

map.entry("hits")
    .and_modify(|n| *n += 1)
    .or_insert(1);

map.entry("hits")
    .and_modify(|n| *n += 1)
    .or_insert(1);

assert_eq!(map["hits"], 2);
```

---

## Iterators & Extend

```rust
use axhash_map::{AxHashMap, AxHashSet};

let map: AxHashMap<&str, usize> =
    [("a", 1), ("b", 2)]
        .into_iter()
        .collect();

let set: AxHashSet<i32> =
    [1, 2, 3, 2]
        .into_iter()
        .collect();
```

---

## Raw hashbrown interoperability

```rust
use core::hash::BuildHasherDefault;

use axhash_map::{
    AxHashMap,
    RawHashMap,
    AxHasher,
};

let raw: RawHashMap<
    &str,
    u32,
    BuildHasherDefault<AxHasher>
> = RawHashMap::with_hasher(
    BuildHasherDefault::default()
);

let wrapped: AxHashMap<&str, u32> = raw.into();
```

---

## Custom seed

Use a random seed when handling untrusted external input.

```rust
use axhash_map::{AxBuildHasher, AxHashMap};

let seed = 0x1234_5678_9abc_def0;

let map: AxHashMap<
    String,
    String,
    AxBuildHasher
> = AxHashMap::with_hasher(
    AxBuildHasher::with_seed(seed)
);
```

---

## Links

- Crate: https://crates.io/crates/axhash-map
- Docs: https://docs.rs/axhash-map
- hashbrown: https://crates.io/crates/hashbrown
- axhash: https://crates.io/crates/axhash

---

## License

MIT