use std::time::Instant;
use core::{
fmt::{
Display,
Formatter,
Result as Format
},
time::Duration
};
use super::toissue::ToIssue;
pub struct Action<Problem: ToIssue, Type> {
pub start: Instant,
pub duration: Duration,
pub(super) problems: Vec<Problem>,
pub(super) value: Option<Type>
}
impl<Problem: ToIssue, Type> Display for Action<Problem, Type> {
fn fmt(&self, formatter: &mut Formatter<'_>) -> Format {
for problem in self.problems.iter() {write!(formatter, "{}", problem.to_issue())?};
return Ok(());
}
}
impl<Problem: ToIssue, Type> Action<Problem, Type> {
pub fn problems<'valid>(&'valid self) -> &'valid [Problem] {return &self.problems}
#[inline]
pub fn result(self) -> Option<Type> {return self.value}
}