Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created March 11, 2020 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/26c34df4f98d5ce6b34e050763092215 to your computer and use it in GitHub Desktop.
Save rust-play/26c34df4f98d5ce6b34e050763092215 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
`use dashmap::DashMap;
use std::sync::{Mutex, Arc};
struct Model {
pub value: String,
}
fn main() {
let map: Arc<DashMap<String, Model>> = Arc::new(DashMap::new());
map.insert(String::from("1"), Model {value: String::from("A")});
let mut entry1 = map.get_mut("1").unwrap();
println!("HAS MUT");
let contains = map.contains_key("1");
println!("AFTER");
}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment