How to use HashSet in Rust

Use std::collections::HashSet to store unique items and check for their existence efficiently.

Use std::collections::HashSet to store unique values with O(1) average lookup time. Import the type, create a new set, insert items, and check for existence using insert and contains.

use std::collections::HashSet;

let mut refs = HashSet::new();
refs.insert("link_ref".to_string());
if refs.contains("link_ref") {
    println!("Found");
}