mirror of
https://github.com/PacktPublishing/Rust-High-Performance.git
synced 2026-01-25 02:34:19 +09:00
19 lines
403 B
Rust
19 lines
403 B
Rust
// Note: this should not compile.
|
|
|
|
use std::thread;
|
|
|
|
fn main() {
|
|
let my_vec = vec![10, 33, 54];
|
|
|
|
let handle = thread::Builder::new()
|
|
.name("my thread".to_owned())
|
|
.spawn(|| {
|
|
println!("This is my vector: {:?}", my_vec);
|
|
})
|
|
.expect("could not create the thread");
|
|
|
|
if handle.join().is_err() {
|
|
println!("Something bad happened :(");
|
|
}
|
|
}
|