Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
include:
- rust: 1.82.0 # MSRV
- rust: 1.85.0 # MSRV
features:
- rust: stable
features: arbitrary
Expand All @@ -40,12 +40,6 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Lock MSRV-compatible dependencies
if: matrix.rust == '1.82.0'
env:
CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback
# Note that this uses the runner's pre-installed stable cargo
run: cargo generate-lockfile
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
Expand All @@ -72,19 +66,13 @@ jobs:
strategy:
matrix:
include:
- rust: 1.82.0
- rust: 1.85.0
target: thumbv6m-none-eabi
- rust: stable
target: thumbv6m-none-eabi

steps:
- uses: actions/checkout@v4
- name: Lock MSRV-compatible dependencies
if: matrix.rust == '1.82.0'
env:
CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback
# Note that this uses the runner's pre-installed stable cargo
run: cargo generate-lockfile
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
Expand Down Expand Up @@ -124,14 +112,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/rust-toolchain@1.82.0 # MSRV
- uses: dtolnay/rust-toolchain@1.85.0 # MSRV
- uses: taiki-e/install-action@v2
with:
tool: cargo-hack
- name: Lock minimal direct dependencies
run: cargo +nightly hack generate-lockfile --remove-dev-deps -Z direct-minimal-versions
env:
CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback
- name: Build (nightly)
run: cargo +nightly build --verbose --all-features
- name: Build (MSRV)
Expand Down
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
edition = "2021"
edition = "2024"
12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[package]
name = "ordermap"
edition = "2021"
version = "1.1.0"
edition = "2024"
version = "1.2.0"
documentation = "https://docs.rs/ordermap/"
repository = "https://github.com/indexmap-rs/ordermap"
license = "Apache-2.0 OR MIT"
description = "A hash table with consistent order and fast iteration."
keywords = ["hashmap", "no_std"]
categories = ["data-structures", "no-std"]
rust-version = "1.82"
rust-version = "1.85"

[lib]
bench = false

[dependencies]
indexmap = { version = "2.13.0", default-features = false }
indexmap = { version = "2.14.0", default-features = false }

arbitrary = { version = "1.0", optional = true, default-features = false }
quickcheck = { version = "1.0", optional = true, default-features = false }
Expand All @@ -31,7 +31,9 @@ serde = { version = "1.0.220", default-features = false, optional = true }
[dev-dependencies]
itertools = "0.14"
fastrand = { version = "2", default-features = false }
quickcheck = { version = "1.0", default-features = false }
# There's a false dependency cycle in indexmap/quickcheck with 1.1:
# https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/cycle.20with.20.60indexmap.2Fquickcheck.60/with/583611414
quickcheck = { version = "~1.0", default-features = false }
fnv = "1.0"
serde = { version = "1.0", default-features = false, features = ["derive"] }

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![build status](https://github.com/indexmap-rs/ordermap/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/indexmap-rs/ordermap/actions)
[![crates.io](https://img.shields.io/crates/v/ordermap.svg)](https://crates.io/crates/ordermap)
[![docs](https://docs.rs/ordermap/badge.svg)](https://docs.rs/ordermap)
[![rustc](https://img.shields.io/badge/rust-1.82%2B-orange.svg)](https://img.shields.io/badge/rust-1.82%2B-orange.svg)
[![rustc](https://img.shields.io/badge/rust-1.85%2B-orange.svg)](https://img.shields.io/badge/rust-1.85%2B-orange.svg)

A pure-Rust hash table which preserves (in a limited sense) insertion order.

Expand Down
6 changes: 6 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Releases

## 1.2.0 (2026-02-09)

- **MSRV**: Rust 1.85.0 or later is now required.
- Updated the `indexmap` dependency to version 2.14.0.
- New features include `const`-ified methods on `Slice` types.

## 1.1.0 (2026-01-07)

- Updated the `indexmap` dependency to version 2.13.0 for new features:
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
//!
//! ### Rust Version
//!
//! This version of ordermap requires Rust 1.82 or later.
//! This version of ordermap requires Rust 1.85 or later.
//!
//! The ordermap 1.x release series will use a carefully considered version
//! upgrade policy, where in a later 1.x version, we will raise the minimum
Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
macro_rules! ordermap_with_default {
($H:ty; $($key:expr => $value:expr,)+) => { $crate::ordermap_with_default!($H; $($key => $value),+) };
($H:ty; $($key:expr => $value:expr),*) => {{
let builder = ::core::hash::BuildHasherDefault::<$H>::default();
let builder = ::core::hash::BuildHasherDefault::<$H>::new();
const CAP: usize = <[()]>::len(&[$({ stringify!($key); }),*]);
#[allow(unused_mut)]
// Specify your custom `H` (must implement Default + Hasher) as the hasher:
Expand Down
5 changes: 4 additions & 1 deletion src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,14 +812,17 @@ where
self.inner.get_full_mut(key)
}

/// Return the values for `N` keys. If any key is duplicated, this function will panic.
/// Return the values for `N` keys.
///
/// ***Panics*** if any key is duplicated.
///
/// # Examples
///
/// ```
/// let mut map = ordermap::OrderMap::from([(1, 'a'), (3, 'b'), (2, 'c')]);
/// assert_eq!(map.get_disjoint_mut([&2, &1]), [Some(&mut 'c'), Some(&mut 'a')]);
/// ```
#[track_caller]
pub fn get_disjoint_mut<Q, const N: usize>(&mut self, keys: [&Q; N]) -> [Option<&mut V>; N]
where
Q: ?Sized + Hash + Equivalent<K>,
Expand Down
2 changes: 1 addition & 1 deletion src/map/raw_entry_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
use crate::{Equivalent, OrderMap};
use core::fmt;
use core::hash::{BuildHasher, Hash};
use indexmap::map::raw_entry_v1 as ix;
use indexmap::map::RawEntryApiV1 as _;
use indexmap::map::raw_entry_v1 as ix;

#[cfg(doc)]
use alloc::vec::Vec;
Expand Down
3 changes: 1 addition & 2 deletions test-nostd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[package]
name = "test-nostd"
version = "0.1.0"
publish = false
edition = "2021"
edition = "2024"

[dependencies.ordermap]
path = ".."
Expand Down
3 changes: 1 addition & 2 deletions test-serde/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[package]
name = "test-serde"
version = "0.1.0"
publish = false
edition = "2021"
edition = "2024"

[dependencies]

Expand Down
4 changes: 2 additions & 2 deletions test-serde/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![cfg(test)]

use fnv::FnvBuildHasher;
use ordermap::{ordermap, orderset, OrderMap, OrderSet};
use ordermap::{OrderMap, OrderSet, ordermap, orderset};
use serde::{Deserialize, Serialize};
use serde_test::{assert_tokens, Token};
use serde_test::{Token, assert_tokens};

#[test]
fn test_serde_map() {
Expand Down
3 changes: 1 addition & 2 deletions test-sval/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[package]
name = "test-sval"
version = "0.1.0"
publish = false
edition = "2021"
edition = "2024"

[dependencies]

Expand Down
4 changes: 2 additions & 2 deletions test-sval/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg(test)]

use fnv::FnvBuildHasher;
use ordermap::{ordermap, orderset, OrderMap, OrderSet};
use sval_test::{assert_tokens, Token};
use ordermap::{OrderMap, OrderSet, ordermap, orderset};
use sval_test::{Token, assert_tokens};

#[test]
fn test_sval_map() {
Expand Down
2 changes: 1 addition & 1 deletion tests/equivalent_trait.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ordermap::ordermap;
use ordermap::Equivalent;
use ordermap::ordermap;

use std::hash::Hash;

Expand Down
31 changes: 17 additions & 14 deletions tests/quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ macro_rules! quickcheck_limit {
let mut quickcheck = QuickCheck::new();
if cfg!(miri) {
quickcheck = quickcheck
.gen(Gen::new(10))
.r#gen(Gen::new(10))
.tests(10)
.max_tests(100);
}
Expand Down Expand Up @@ -164,7 +164,7 @@ quickcheck_limit! {
}
}
}
let hsorted = hmap.iter().sorted_by_key(|(&k, _)| (k.unsigned_abs(), k));
let hsorted = hmap.iter().sorted_by_key(|&(&k, _)| (k.unsigned_abs(), k));
itertools::assert_equal(hsorted, &map);
itertools::assert_equal(&map, &map2);
true
Expand Down Expand Up @@ -518,10 +518,11 @@ where

// Check both iteration order and hash lookups
assert!(map.keys().eq(vec.iter()));
assert!(vec
.iter()
.enumerate()
.all(|(i, x)| { map.get_index_of(x) == Some(i) }));
assert!(
vec.iter()
.enumerate()
.all(|(i, x)| { map.get_index_of(x) == Some(i) })
);
TestResult::passed()
}

Expand All @@ -545,10 +546,11 @@ where

// Check both iteration order and hash lookups
assert!(map.keys().eq(vec.iter()));
assert!(vec
.iter()
.enumerate()
.all(|(i, x)| { map.get_index_of(x) == Some(i) }));
assert!(
vec.iter()
.enumerate()
.all(|(i, x)| { map.get_index_of(x) == Some(i) })
);
TestResult::passed()
}

Expand All @@ -574,10 +576,11 @@ where

// Check both iteration order and hash lookups
assert!(map.keys().eq(vec.iter()));
assert!(vec
.iter()
.enumerate()
.all(|(i, x)| { map.get_index_of(x) == Some(i) }));
assert!(
vec.iter()
.enumerate()
.all(|(i, x)| { map.get_index_of(x) == Some(i) })
);
TestResult::passed()
}

Expand Down
Loading