mirror of
https://github.com/PacktPublishing/Rust-High-Performance.git
synced 2026-01-25 02:34:19 +09:00
12 lines
313 B
Rust
12 lines
313 B
Rust
use std::cell::RefCell;
|
|
use std::collections::HashMap;
|
|
|
|
fn main() {
|
|
let hm = HashMap::new();
|
|
let my_cell = RefCell::new(hm);
|
|
println!("Initial cell value: {:?}", my_cell.borrow());
|
|
|
|
my_cell.borrow_mut().insert("test_key", "test_value");
|
|
println!("Final cell value: {:?}", my_cell.borrow());
|
|
}
|