mirror of
https://bitbucket.org/Mattrixwv/projecteulerrust.git
synced 2025-12-06 17:43:58 -05:00
16 lines
376 B
Rust
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}
|
|
}
|
|
}
|