openraft_rt/mpsc/try_recv_error.rs
1use std::fmt;
2
3/// Error returned by `try_recv`.
4#[derive(PartialEq, Eq, Clone, Copy, Debug)]
5pub enum TryRecvError {
6 /// This **channel** is currently empty, but the **Sender**(s) have not yet
7 /// disconnected, so data may yet become available.
8 Empty,
9 /// The **channel**'s sending half has become disconnected, and there will
10 /// never be any more data received on it.
11 Disconnected,
12}
13
14impl fmt::Display for TryRecvError {
15 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
16 match *self {
17 TryRecvError::Empty => "receiving on an empty channel".fmt(fmt),
18 TryRecvError::Disconnected => "receiving on a closed channel".fmt(fmt),
19 }
20 }
21}
22
23impl std::error::Error for TryRecvError {}