Search
 
SCRIPT & CODE EXAMPLE
 

RUST

Rust Hashset

use std::collections::HashSet;
// Type inference lets us omit an explicit type signature (which
// would be `HashSet<String>` in this example).
let mut books = HashSet::new();

// Add some books.
books.insert("A Dance With Dragons".to_string());
books.insert("To Kill a Mockingbird".to_string());
books.insert("The Odyssey".to_string());
books.insert("The Great Gatsby".to_string());

// Check for a specific one.
if !books.contains("The Winds of Winter") {
    println!("We have {} books, but The Winds of Winter ain't one.",
             books.len());
}

// Remove a book.
books.remove("The Odyssey");

// Iterate over everything.
for book in &books {
    println!("{book}");
}
Comment

rust hashset

use hashset::hashset;
//	The `hashset!` macro is provided by this crate.

fn main() {
    let mut set = hashset!["a", "b", "c"];
    set.insert("d");
    set.remove("a");
    assert!(set.contains("d"));
    for x in &set {
        println!("{}", x);
    }
}
Comment

PREVIOUS NEXT
Code Example
Rust :: rust match enum 
Rust :: rust string split 
Lua :: roblox for children loop 
Lua :: luau rainbow part 
Lua :: get all players roblox 
Lua :: how to choose a random item from a table lua 
Lua :: roblox get humanoid state 
Lua :: if part is touched 
Lua :: lua string to number 
Lua :: roblox how to loop through all players 
Lua :: forever loop in lua 
Lua :: roblox studio random part color 
Lua :: lua gsub 
Lua :: lua while loops 
Lua :: Lua numbers 
Lua :: lua print 
Lua :: lua function 
Lua :: cmder not taking lua file 
Lua :: svelte template 
Lua :: lua stack 
Lua :: when do true loop on roblox 
Lua :: roblox lua exploiting rconsole 
Matlab :: dat file in matlab 
Matlab :: alternative from two vectors matlab 
Basic :: basic 
Basic :: Loop inner fiter() 
Elixir :: elixir map to new map 
Scala :: scala get file from url as string 
Scala :: how to get absolute value in scala 
Excel :: google sheets concatenate non blank cells from two columns 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =