1use std::fmt;
4
5#[derive(Debug)]
7pub struct SendError<T> {
8 pub(crate) inner: T,
9}
10
11impl<T> SendError<T> {
14 pub fn value(self) -> T {
17 self.inner
18 }
19}
20
21impl<T: fmt::Debug> fmt::Display for SendError<T> {
22 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
23 write!(fmt, "channel closed")
24 }
25}
26
27impl<T: fmt::Debug> std::error::Error for SendError<T> {}
28
29#[derive(Debug)]
31pub struct RecvError {}
32
33impl fmt::Display for RecvError {
34 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
35 write!(fmt, "channel closed")
36 }
37}
38
39impl std::error::Error for RecvError {}