mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
stream: implement Error and Display for BroadcastStreamRecvError (#3745)
This commit is contained in:
@@ -27,6 +27,16 @@ pub enum BroadcastStreamRecvError {
|
|||||||
Lagged(u64),
|
Lagged(u64),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for BroadcastStreamRecvError {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
BroadcastStreamRecvError::Lagged(amt) => write!(f, "channel lagged by {}", amt),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::error::Error for BroadcastStreamRecvError {}
|
||||||
|
|
||||||
async fn make_future<T: Clone>(mut rx: Receiver<T>) -> (Result<T, RecvError>, Receiver<T>) {
|
async fn make_future<T: Clone>(mut rx: Receiver<T>) -> (Result<T, RecvError>, Receiver<T>) {
|
||||||
let result = rx.recv().await;
|
let result = rx.recv().await;
|
||||||
(result, rx)
|
(result, rx)
|
||||||
|
|||||||
Reference in New Issue
Block a user