Skip to content

Commit

Permalink
feat!: add blanket impl for IndexKey instead of macro on all usigned …
Browse files Browse the repository at this point in the history
…ints (#64)
  • Loading branch information
rinde authored Jun 14, 2024
1 parent 2928b38 commit f507731
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 94 deletions.
35 changes: 35 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ smallvec = { version = "1.13.2", features = [

[dev-dependencies]
criterion = { version = "0.5.1", features = ["html_reports"] }
derive_more = "0.99.17"
indexmap = { version = "2.1.0" }
itertools = "0.12.1"
maplit = { version = "1.0.2" }
more_collections = { path = ".", features = ["all"] }
rand = "0.8.5"
itertools = "0.12.1"

[[bench]]
name = "vec_map"
Expand Down
13 changes: 7 additions & 6 deletions src/vec_map/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,13 @@ where

#[cfg(test)]
mod test {
use crate::vec_map::test::MyKey;
use crate::vecmap;
use crate::VecMap;

#[test]
fn test_iter() {
let map = vecmap! { 9u16 => "nine", 17 => "seventeen", 2 => "two"};
let map = vecmap! { 9 => "nine", 17 => "seventeen", 2 => "two"};

// forward
let mut iter = map.iter();
Expand Down Expand Up @@ -364,7 +365,7 @@ mod test {

#[test]
fn test_iter_mut() {
let mut map = vecmap! { 9u16 => "nine", 17 => "seventeen", 2 => "two"};
let mut map = vecmap! { 9 => "nine", 17 => "seventeen", 2 => "two"};

// forward
let mut iter = map.iter_mut();
Expand Down Expand Up @@ -403,7 +404,7 @@ mod test {

#[test]
fn test_into_iter() {
let map = vecmap! { 9u16 => "nine", 17 => "seventeen", 2 => "two"};
let map = vecmap! { 9 => "nine", 17 => "seventeen", 2 => "two"};

// forward
let mut iter = map.into_iter();
Expand All @@ -416,7 +417,7 @@ mod test {
assert_eq!(0, iter.len());
assert_eq!(None, iter.next());

let map = vecmap! { 9u16 => "nine", 17 => "seventeen", 2 => "two"};
let map = vecmap! { 9 => "nine", 17 => "seventeen", 2 => "two"};
// back, forward, back
let mut iter = map.into_iter();
assert_eq!(3, iter.len());
Expand All @@ -437,7 +438,7 @@ mod test {

#[test]
fn test_keys() {
let map = vecmap! { 9u16 => "nine", 17 => "seventeen", 2 => "two"};
let map = vecmap! { 9 => "nine", 17 => "seventeen", 2 => "two"};

// forward
let mut iter = map.keys();
Expand Down Expand Up @@ -470,7 +471,7 @@ mod test {

#[test]
fn test_values() {
let map = vecmap! { 9u16 => "nine", 17 => "seventeen", 2 => "two"};
let map = vecmap! { MyKey(9) => "nine", MyKey(17) => "seventeen", MyKey(2) => "two"};

// forward
let mut iter = map.values();
Expand Down
Loading

0 comments on commit f507731

Please sign in to comment.