Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate mpsc::RecvError #3833

Merged
merged 2 commits into from Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions tokio/src/sync/mpsc/bounded.rs
Expand Up @@ -65,7 +65,7 @@ pub struct Receiver<T> {
/// with backpressure.
///
/// The channel will buffer up to the provided number of messages. Once the
/// buffer is full, attempts to `send` new messages will wait until a message is
/// buffer is full, attempts to send new messages will wait until a message is
/// received from the channel. The provided buffer capacity must be at least 1.
///
/// All data sent on `Sender` will become available on `Receiver` in the same
Expand All @@ -76,7 +76,7 @@ pub struct Receiver<T> {
///
/// If the `Receiver` is disconnected while trying to `send`, the `send` method
/// will return a `SendError`. Similarly, if `Sender` is disconnected while
/// trying to `recv`, the `recv` method will return a `RecvError`.
/// trying to `recv`, the `recv` method will return `None`.
///
/// # Panics
///
Expand Down
4 changes: 4 additions & 0 deletions tokio/src/sync/mpsc/error.rs
Expand Up @@ -55,14 +55,18 @@ impl<T> From<SendError<T>> for TrySendError<T> {

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

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

#[allow(deprecated)]
impl Error for RecvError {}

cfg_time! {
Expand Down