pub mod action;
pub mod issue;
pub mod toissue;
use std::time::Instant;
use core::default::Default;
use action::Action;
use toissue::ToIssue;
pub struct Report<Problem: ToIssue> {
start: Instant,
problems: Vec<Problem>
}
impl<Problem: ToIssue> Default for Report<Problem> {
fn default() -> Self {return Self {
start: Instant::now(),
problems: Vec::new()
}}
}
impl<Problem: ToIssue> Report<Problem> {
#[inline]
pub fn warn(&mut self, problem: Problem) -> () {self.problems.push(problem)}
pub fn fail<Type>(self) -> Action<Problem, Type> {return Action {
start: self.start,
duration: Instant::duration_since(&Instant::now(), self.start),
problems: self.problems,
value: None
}}
pub fn conclude<Type>(self, value: Type) -> Action<Problem, Type> {return Action {
start: self.start,
duration: Instant::duration_since(&Instant::now(), self.start),
problems: self.problems,
value: Some(value)
}}
}