Skip to content

Commit cb147a2

Browse files
authored
sync: deprecate mpsc::RecvError (#3833)
1 parent f759240 commit cb147a2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

tokio/src/sync/mpsc/bounded.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub struct Receiver<T> {
6565
/// with backpressure.
6666
///
6767
/// The channel will buffer up to the provided number of messages. Once the
68-
/// buffer is full, attempts to `send` new messages will wait until a message is
68+
/// buffer is full, attempts to send new messages will wait until a message is
6969
/// received from the channel. The provided buffer capacity must be at least 1.
7070
///
7171
/// All data sent on `Sender` will become available on `Receiver` in the same
@@ -76,7 +76,7 @@ pub struct Receiver<T> {
7676
///
7777
/// If the `Receiver` is disconnected while trying to `send`, the `send` method
7878
/// will return a `SendError`. Similarly, if `Sender` is disconnected while
79-
/// trying to `recv`, the `recv` method will return a `RecvError`.
79+
/// trying to `recv`, the `recv` method will return `None`.
8080
///
8181
/// # Panics
8282
///

tokio/src/sync/mpsc/error.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,18 @@ impl<T> From<SendError<T>> for TrySendError<T> {
5555

5656
/// Error returned by `Receiver`.
5757
#[derive(Debug)]
58+
#[doc(hidden)]
59+
#[deprecated(note = "This type is unused because recv returns an Option.")]
5860
pub struct RecvError(());
5961

62+
#[allow(deprecated)]
6063
impl fmt::Display for RecvError {
6164
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
6265
write!(fmt, "channel closed")
6366
}
6467
}
6568

69+
#[allow(deprecated)]
6670
impl Error for RecvError {}
6771

6872
cfg_time! {

0 commit comments

Comments
 (0)