1use crate::RxError;
2use thiserror::Error;
3
4#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq, Hash)]
7pub enum SendCheckedError<M> {
8 Closed(M),
9 NotAccepted(M),
10}
11
12#[derive(Debug, Clone, PartialEq, Eq, Hash, Error)]
14pub struct SendError<M>(pub M);
15
16#[derive(Debug, thiserror::Error, Clone, Copy, PartialEq, Eq)]
20pub enum RequestError<M> {
21 NoReply,
22 Closed(M),
23}
24
25impl<T> From<SendError<T>> for SendCheckedError<T> {
26 fn from(err: SendError<T>) -> Self {
27 Self::Closed(err.0)
28 }
29}
30
31impl<T> From<RxError> for RequestError<T> {
32 fn from(RxError: RxError) -> Self {
33 Self::NoReply
34 }
35}
36
37impl<T> From<SendError<T>> for RequestError<T> {
38 fn from(err: SendError<T>) -> Self {
39 Self::Closed(err.0)
40 }
41}