You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
311 B
Rust
14 lines
311 B
Rust
3 years ago
|
use std::fs;
|
||
|
use std::thread;
|
||
|
fn copy_file() -> thread::Result<()> {
|
||
|
thread::spawn(|| {
|
||
|
fs::copy("a.txt", "b.txt").expect("Error occurred");
|
||
|
})
|
||
|
.join()
|
||
|
}
|
||
|
fn main() {
|
||
|
match copy_file() {
|
||
|
Ok(_) => println!("Ok. copied"),
|
||
|
Err(_) => println!("Error in copying file"),
|
||
|
}
|
||
|
}
|