Skip to content

Commit

Permalink
Add no no_std support
Browse files Browse the repository at this point in the history
  • Loading branch information
virtualritz authored and ogxd committed Dec 25, 2023
1 parent df7660e commit cea3351
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ categories = ["algorithms", "data-structures", "no-std"]
exclude = ["article/*"]

[features]
default = ["std"]
std = []
# Only relevant for throughput benchmarks
bench-csv = []
bench-md = []
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ GxHash is compatible with:
### Hashes Stability
All generated hashes for a given version of GxHash are stable, meaning that for a given input the output hash will be the same across all supported platforms.

### `no_std`

The `std` feature flag enables the `HashMap`/`HashSet` container convenience type aliases. This is on by default. Disable to make the crate `no_std`:

```toml
[dependencies.gxhash]
...
default-features = false
```

## Benchmarks

To run the benchmarks locally use one of the following:
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(not(feature = "std"), no_std)]
// Hybrid SIMD width usage currently requires unstable 'stdsimd'
#![cfg_attr(hybrid, feature(stdsimd))]

Expand All @@ -6,4 +7,6 @@ mod gxhash;
mod hasher;

pub use crate::gxhash::*;

#[cfg(feature = "std")]
pub use crate::hasher::*;

0 comments on commit cea3351

Please sign in to comment.