use crate::RxError;
use thiserror::Error;
#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq, Hash)]
pub enum SendCheckedError<M> {
Closed(M),
NotAccepted(M),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Error)]
pub struct SendError<M>(pub M);
#[derive(Debug, thiserror::Error, Clone, Copy, PartialEq, Eq)]
pub enum RequestError<M> {
NoReply,
Closed(M),
}
impl<T> From<SendError<T>> for SendCheckedError<T> {
fn from(err: SendError<T>) -> Self {
Self::Closed(err.0)
}
}
impl<T> From<RxError> for RequestError<T> {
fn from(RxError: RxError) -> Self {
Self::NoReply
}
}
impl<T> From<SendError<T>> for RequestError<T> {
fn from(err: SendError<T>) -> Self {
Self::Closed(err.0)
}
}