mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-05 04:58:03 +08:00
14 lines
208 B
Rust
14 lines
208 B
Rust
|
use std::thread;
|
||
|
|
||
|
fn main() {
|
||
|
let v = vec![1, 2, 3];
|
||
|
|
||
|
let handle = thread::spawn(move || {
|
||
|
println!("Here's a vector: {:?}", v);
|
||
|
});
|
||
|
|
||
|
drop(v); // oh no!
|
||
|
|
||
|
handle.join().unwrap();
|
||
|
}
|