Files
ProjectEulerRust/src/Problems/Answer.rs

16 lines
376 B
Rust

//A structure to hold the answer to the problem
pub struct Answer{
result: String,
time: String,
}
impl std::fmt::Display for Answer{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result{
write!(f, "{}\nIt took {} to solve this problem", self.result, self.time)
}
}
impl Answer{
pub fn new(result: String, time: String) -> Answer{
Answer{result, time}
}
}