use core::fmt;
#[derive(Debug)]
pub enum CallError<E> {
Transport(E),
Cancelled,
}
impl<E: fmt::Display> fmt::Display for CallError<E> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
CallError::Transport(e) => write!(f, "transport error: {e}"),
CallError::Cancelled => write!(f, "request cancelled by service"),
}
}
}
pub trait TransportResult<T>: Sized {
type Output;
fn into_output(result: Result<T, Self>) -> Self::Output;
}
impl<T> TransportResult<T> for core::convert::Infallible {
type Output = T;
fn into_output(result: Result<T, Self>) -> T {
match result {
Ok(val) => val,
Err(inf) => match inf {},
}
}
}