Skip to content

Latest commit

 

History

History
19 lines (16 loc) · 412 Bytes

quiz3.md

File metadata and controls

19 lines (16 loc) · 412 Bytes
use std::fmt::{Debug, Display};

#[derive(Debug)]
pub struct ReportCard<T: Display> {
    pub grade: T,
    pub student_name: String,
    pub student_age: u8,
}

// impl<T: std::fmt::Debug> ReportCard<T> {}

impl<T: Display> ReportCard<T> {
    pub fn print(&self) -> String {
        format!("{} ({}) - achieved a grade of {}",
            &self.student_name, &self.student_age, &self.grade)
    }
}