Skip to content

elements_are does not support containers that don't iterate over borrows #351

@kupiakos

Description

@kupiakos

Example:

struct IntContainer(Vec<i32>);
impl<'a> IntoIterator for &'a IntContainer {
    type IntoIter = std::iter::Copied<std::slice::Iter<'a, i32>>;
    type Item = i32;
    fn into_iter(self) -> Self::IntoIter {
        self.0.iter().copied()
    }
}

// I expect to be able to write:
let c = IntContainer(vec![1,2,3]);
assert_that!(c, elements_are![eq(1), eq(2), eq(3)]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions