Skip to content

Conversation

stepantubanov
Copy link

This allows nested comparisons:

fn test_nested_eq() {
    let array: ArrayVec<ArrayVec<_, 2>, 5> = (0..3)
        .map(|i| ArrayVec::from([i, i + 1]))
        .collect();

    assert_eq!(array, [[0, 1], [1, 2], [2, 3]]);
}

fn test_vec_of_strings_equality() {
    let vec = ArrayVec::from([
        ArrayString::<8>::from("one").unwrap(),
        ArrayString::<8>::from("two").unwrap(),
        ArrayString::<8>::from("three").unwrap(),
    ]);
    assert_eq!(vec, ["one", "two", "three"]);
}

Implementation is similar to std https://doc.rust-lang.org/src/alloc/vec/partial_eq.rs.html#7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant