use crate::{
diagnostic::PublicEvidence,
http::{EncodedProblem, Problem, ProblemEncodeError},
};
use super::PrivateReport;
#[derive(Debug)]
pub struct Fault<E: PublicEvidence> {
problem: Problem<E>,
report: PrivateReport,
}
impl<E: PublicEvidence> Fault<E> {
pub const fn new(problem: Problem<E>, report: PrivateReport) -> Self {
Self { problem, report }
}
pub const fn problem(&self) -> &Problem<E> {
&self.problem
}
pub const fn report(&self) -> &PrivateReport {
&self.report
}
pub fn try_encode(&self) -> Result<EncodedProblem, ProblemEncodeError> {
self.problem.try_encode()
}
pub fn into_parts(self) -> (Problem<E>, PrivateReport) {
(self.problem, self.report)
}
}