I have a large list of data in a text file. I read the text file and added each line to a vector, but when I check if some string exists in that vector using contain method, the app slows down. I saw the same kine of functionality in python with pickle which it was really fast. How can make checking if something exist in a vector faster?
In order for .contains() to find an element in the Vec, it must traverse each element and compare the element to the search string to check if it's there.  The easiest optimization you can make is to use a HashMap instead, where the key is the string you want to search for, and the value can be () since it's not important.  You can then search for a given string with .get() and either get Some(()) if it's contained in the map or None otherwise.  It's possible to iterate over all elements of a hashmap, so you can still retrieve all the stored values, but you'll gain a much faster ability to search
What is the fastest way to check if something exist in a vector in Rust?