Develop a multi-threaded program that demonstrates the use of threads in Rust.
-
Spawn Multiple Threads
- Write a program that spawns a specified number of threads (e.g., 5).
- Each thread should print its own unique identifier (e.g., thread number).
-
Join Threads
- Ensure that the main thread waits for all spawned threads to complete before exiting.
-
Experiment
- Modify the number of threads and observe the output.
- Change the task performed by each thread to something simple, like counting or performing a calculation.