use super::{Problem, ProblemCollection};
use rootcause::{IntoReport, IntoReportCollection};
pub trait IntoProblem<ThreadSafetyT> {
type Context: ?Sized + 'static;
type Ownership: 'static;
fn into_problem(self) -> Problem<Self::Context, Self::Ownership, ThreadSafetyT>;
}
impl<IntoReportT, ThreadSafetyT> IntoProblem<ThreadSafetyT> for IntoReportT
where
IntoReportT: IntoReport<ThreadSafetyT>,
{
type Context = IntoReportT::Context;
type Ownership = IntoReportT::Ownership;
fn into_problem(self) -> Problem<Self::Context, Self::Ownership, ThreadSafetyT> {
self.into_report()
}
}
pub trait IntoProblemCollection<ThreadSafetyT> {
type Context: ?Sized + 'static;
fn into_problem_collection(self) -> ProblemCollection<Self::Context, ThreadSafetyT>;
}
impl<IntoReportCollectionT, ThreadSafetyT> IntoProblemCollection<ThreadSafetyT> for IntoReportCollectionT
where
IntoReportCollectionT: IntoReportCollection<ThreadSafetyT>,
{
type Context = IntoReportCollectionT::Context;
fn into_problem_collection(self) -> ProblemCollection<Self::Context, ThreadSafetyT> {
self.into_report_collection()
}
}