sync: add Clone to RecvError types (#4560)

This commit is contained in:
Stepan Koltsov 2022-04-06 14:26:45 +01:00 committed by GitHub
parent b98a7e4d07
commit 3652f71ade
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View File

@ -18,7 +18,7 @@ pub struct BroadcastStream<T> {
} }
/// An error returned from the inner stream of a [`BroadcastStream`]. /// An error returned from the inner stream of a [`BroadcastStream`].
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Clone)]
pub enum BroadcastStreamRecvError { pub enum BroadcastStreamRecvError {
/// The receiver lagged too far behind. Attempting to receive again will /// The receiver lagged too far behind. Attempting to receive again will
/// return the oldest message still retained by the channel. /// return the oldest message still retained by the channel.

View File

@ -230,7 +230,7 @@ pub mod error {
/// ///
/// [`recv`]: crate::sync::broadcast::Receiver::recv /// [`recv`]: crate::sync::broadcast::Receiver::recv
/// [`Receiver`]: crate::sync::broadcast::Receiver /// [`Receiver`]: crate::sync::broadcast::Receiver
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Clone)]
pub enum RecvError { pub enum RecvError {
/// There are no more active senders implying no further messages will ever /// There are no more active senders implying no further messages will ever
/// be sent. /// be sent.
@ -258,7 +258,7 @@ pub mod error {
/// ///
/// [`try_recv`]: crate::sync::broadcast::Receiver::try_recv /// [`try_recv`]: crate::sync::broadcast::Receiver::try_recv
/// [`Receiver`]: crate::sync::broadcast::Receiver /// [`Receiver`]: crate::sync::broadcast::Receiver
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Clone)]
pub enum TryRecvError { pub enum TryRecvError {
/// The channel is currently empty. There are still active /// The channel is currently empty. There are still active
/// [`Sender`] handles, so data may yet become available. /// [`Sender`] handles, so data may yet become available.

View File

@ -78,7 +78,7 @@ impl Error for TryRecvError {}
// ===== RecvError ===== // ===== RecvError =====
/// Error returned by `Receiver`. /// Error returned by `Receiver`.
#[derive(Debug)] #[derive(Debug, Clone)]
#[doc(hidden)] #[doc(hidden)]
#[deprecated(note = "This type is unused because recv returns an Option.")] #[deprecated(note = "This type is unused because recv returns an Option.")]
pub struct RecvError(()); pub struct RecvError(());

View File

@ -323,11 +323,11 @@ pub mod error {
use std::fmt; use std::fmt;
/// Error returned by the `Future` implementation for `Receiver`. /// Error returned by the `Future` implementation for `Receiver`.
#[derive(Debug, Eq, PartialEq)] #[derive(Debug, Eq, PartialEq, Clone)]
pub struct RecvError(pub(super) ()); pub struct RecvError(pub(super) ());
/// Error returned by the `try_recv` function on `Receiver`. /// Error returned by the `try_recv` function on `Receiver`.
#[derive(Debug, Eq, PartialEq)] #[derive(Debug, Eq, PartialEq, Clone)]
pub enum TryRecvError { pub enum TryRecvError {
/// The send half of the channel has not yet sent a value. /// The send half of the channel has not yet sent a value.
Empty, Empty,

View File

@ -155,7 +155,7 @@ pub mod error {
impl<T: fmt::Debug> std::error::Error for SendError<T> {} impl<T: fmt::Debug> std::error::Error for SendError<T> {}
/// Error produced when receiving a change notification. /// Error produced when receiving a change notification.
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct RecvError(pub(super) ()); pub struct RecvError(pub(super) ());
// ===== impl RecvError ===== // ===== impl RecvError =====