finish until lifetimes

This commit is contained in:
Samuele Iacoponi
2026-02-27 17:15:07 +01:00
parent b1b81f7e07
commit 8c99d4187d
9 changed files with 148 additions and 23 deletions

View File

@@ -12,18 +12,18 @@
// block to support alphabetical report cards in addition to numerical ones.
// TODO: Adjust the struct as described above.
struct ReportCard {
grade: f32,
struct ReportCard<T> {
grade: T,
student_name: String,
student_age: u8,
}
// TODO: Adjust the impl block as described above.
impl ReportCard {
impl<T: std::fmt::Display> ReportCard<T> {
fn print(&self) -> String {
format!(
"{} ({}) - achieved a grade of {}",
&self.student_name, &self.student_age, &self.grade,
&self.student_name, &self.student_age, &self.grade
)
}
}