Skip to content

Commit

Permalink
Rollup merge of rust-lang#76978 - duckymirror:mpsc-from-doc, r=jyn514
Browse files Browse the repository at this point in the history
Documented From impls in std/sync/mpsc/mod.rs

This is for rust-lang#51430.

r? @steveklabnik
  • Loading branch information
Dylan-DPC committed Sep 24, 2020
2 parents 0e4149d + 16eee2a commit bd7f3f1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions library/std/src/sync/mpsc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,11 @@ impl<T: Send> error::Error for TrySendError<T> {

#[stable(feature = "mpsc_error_conversions", since = "1.24.0")]
impl<T> From<SendError<T>> for TrySendError<T> {
/// Converts a `SendError<T>` into a `TrySendError<T>`.
///
/// This conversion always returns a `TrySendError::Disconnected` containing the data in the `SendError<T>`.
///
/// No data is allocated on the heap.
fn from(err: SendError<T>) -> TrySendError<T> {
match err {
SendError(t) => TrySendError::Disconnected(t),
Expand Down Expand Up @@ -1576,6 +1581,11 @@ impl error::Error for TryRecvError {

#[stable(feature = "mpsc_error_conversions", since = "1.24.0")]
impl From<RecvError> for TryRecvError {
/// Converts a `RecvError` into a `TryRecvError`.
///
/// This conversion always returns `TryRecvError::Disconnected`.
///
/// No data is allocated on the heap.
fn from(err: RecvError) -> TryRecvError {
match err {
RecvError => TryRecvError::Disconnected,
Expand Down Expand Up @@ -1606,6 +1616,11 @@ impl error::Error for RecvTimeoutError {

#[stable(feature = "mpsc_error_conversions", since = "1.24.0")]
impl From<RecvError> for RecvTimeoutError {
/// Converts a `RecvError` into a `RecvTimeoutError`.
///
/// This conversion always returns `RecvTimeoutError::Disconnected`.
///
/// No data is allocated on the heap.
fn from(err: RecvError) -> RecvTimeoutError {
match err {
RecvError => RecvTimeoutError::Disconnected,
Expand Down

0 comments on commit bd7f3f1

Please sign in to comment.