use core::fmt::{
Display,
Formatter,
Result as Format
};
use std::process::ExitCode;
#[derive(Clone)]
pub struct Issue {
pub name: &'static str,
pub code: ExitCode,
pub description: Option<String>
}
impl Display for Issue {
fn fmt(&self, formatter: &mut Formatter<'_>) -> Format {write!(formatter, "{}", self.format())}
}
impl Issue {
fn format(&self) -> String {return format!(
"error: {}{}",
self.name,
if let Some(description) = &self.description {format!(
"\n > {}",
description
)} else {String::new()}
)}
}