Other Collections: HashSet, BinaryHeap, LinkedList

Updated

October 31, 2026

Other Collections: HashSet, BinaryHeap, LinkedList

use std::collections::{HashSet, BinaryHeap};

fn main() {
    // HashSet: Unique items
    let mut set = HashSet::new();
    set.insert("admin");
    set.insert("operator");
    println!("Has admin? {}", set.contains("admin"));

    // BinaryHeap: Max-heap priority queue
    let mut heap = BinaryHeap::new();
    heap.push(10);
    heap.push(50);
    heap.push(25);
    println!("Max element: {:?}", heap.pop()); // Some(50)
}