Setup: Say that I have a simple struct, named NewType, with two variables: String and Bool. Using this struct, I’ve constructed a vector of NewTypes inside of a Vec<>.
Question: I tried to perform NewType.iter().filter(|x| x.String.contains(“example”)).collect(), but received a compiler error of the form:
error: the trait `core::iter::FromIterator<&NewType>` is not implemented for the type `collections::vec::Vec` note: a collection of type `collections::vec::Vec` cannot be built from an iterator over elements of type `&NewType`
How might I go about solving this error?