use super::super::problem::*;
use std::error::Error;
pub trait IntoProblemResult<OkT> {
fn into_problem(self) -> Result<OkT, Problem>;
}
impl<OkT> IntoProblemResult<OkT> for Result<OkT, Problem> {
#[track_caller]
fn into_problem(self) -> Result<OkT, Problem> {
self
}
}
impl<OkT, ErrorT> IntoProblemResult<OkT> for Result<OkT, ErrorT>
where
ErrorT: 'static + Error + Send + Sync,
{
#[track_caller]
fn into_problem(self) -> Result<OkT, Problem> {
match self {
Ok(ok) => Ok(ok),
Err(error) => Err(error.into()),
}
}
}