Skip to content

Commit 3652f71

Browse files
authored
sync: add Clone to RecvError types (#4560)
1 parent b98a7e4 commit 3652f71

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

tokio-stream/src/wrappers/broadcast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub struct BroadcastStream<T> {
1818
}
1919

2020
/// An error returned from the inner stream of a [`BroadcastStream`].
21-
#[derive(Debug, PartialEq)]
21+
#[derive(Debug, PartialEq, Clone)]
2222
pub enum BroadcastStreamRecvError {
2323
/// The receiver lagged too far behind. Attempting to receive again will
2424
/// return the oldest message still retained by the channel.

tokio/src/sync/broadcast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ pub mod error {
230230
///
231231
/// [`recv`]: crate::sync::broadcast::Receiver::recv
232232
/// [`Receiver`]: crate::sync::broadcast::Receiver
233-
#[derive(Debug, PartialEq)]
233+
#[derive(Debug, PartialEq, Clone)]
234234
pub enum RecvError {
235235
/// There are no more active senders implying no further messages will ever
236236
/// be sent.
@@ -258,7 +258,7 @@ pub mod error {
258258
///
259259
/// [`try_recv`]: crate::sync::broadcast::Receiver::try_recv
260260
/// [`Receiver`]: crate::sync::broadcast::Receiver
261-
#[derive(Debug, PartialEq)]
261+
#[derive(Debug, PartialEq, Clone)]
262262
pub enum TryRecvError {
263263
/// The channel is currently empty. There are still active
264264
/// [`Sender`] handles, so data may yet become available.

tokio/src/sync/mpsc/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl Error for TryRecvError {}
7878
// ===== RecvError =====
7979

8080
/// Error returned by `Receiver`.
81-
#[derive(Debug)]
81+
#[derive(Debug, Clone)]
8282
#[doc(hidden)]
8383
#[deprecated(note = "This type is unused because recv returns an Option.")]
8484
pub struct RecvError(());

tokio/src/sync/oneshot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,11 @@ pub mod error {
323323
use std::fmt;
324324

325325
/// Error returned by the `Future` implementation for `Receiver`.
326-
#[derive(Debug, Eq, PartialEq)]
326+
#[derive(Debug, Eq, PartialEq, Clone)]
327327
pub struct RecvError(pub(super) ());
328328

329329
/// Error returned by the `try_recv` function on `Receiver`.
330-
#[derive(Debug, Eq, PartialEq)]
330+
#[derive(Debug, Eq, PartialEq, Clone)]
331331
pub enum TryRecvError {
332332
/// The send half of the channel has not yet sent a value.
333333
Empty,

tokio/src/sync/watch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub mod error {
155155
impl<T: fmt::Debug> std::error::Error for SendError<T> {}
156156

157157
/// Error produced when receiving a change notification.
158-
#[derive(Debug)]
158+
#[derive(Debug, Clone)]
159159
pub struct RecvError(pub(super) ());
160160

161161
// ===== impl RecvError =====

0 commit comments

Comments
 (0)