move input files into exercise directory

This commit is contained in:
Remo Senekowitsch
2026-08-29 22:39:33 +03:00
committed by Mo Bitar
parent b50eafb28f
commit d0109d68be
9 changed files with 49 additions and 39 deletions
+7 -3
View File
@@ -6,14 +6,18 @@
// Let's simulate this using asynchronous programming. Each person is
// represented as an asynchronous task, which can be executed concurrently.
const SCORES_CLASS_A: &str = "exercises/24_async/scores_class_a.txt";
const SCORES_CLASS_B: &str = "exercises/24_async/scores_class_b.txt";
const SCORES_CLASS_C: &str = "exercises/24_async/scores_class_c.txt";
// Async tasks need to be executed by a "runtime", which is not provided by
// Rust's standard library. Here, we use the mainstream runtime `tokio`.
// The macro `tokio::main` wraps the entire main function in a runtime.
#[tokio::main]
async fn main() {
let mean_score_a = tokio::spawn(calculate_mean_score("input_files/scores_class_a.txt"));
let mean_score_b = tokio::spawn(calculate_mean_score("input_files/scores_class_b.txt"));
let mean_score_c = tokio::spawn(calculate_mean_score("input_files/scores_class_c.txt"));
let mean_score_a = tokio::spawn(calculate_mean_score(SCORES_CLASS_A));
let mean_score_b = tokio::spawn(calculate_mean_score(SCORES_CLASS_B));
let mean_score_c = tokio::spawn(calculate_mean_score(SCORES_CLASS_C));
// TODO: Await the spawned tasks to check their results.
assert_eq!(mean_score_a, 84); // alice
+3
View File
@@ -0,0 +1,3 @@
83
77
92
+3
View File
@@ -0,0 +1,3 @@
84
88
96
+3
View File
@@ -0,0 +1,3 @@
71
83
76