Skip to content

Commit

Permalink
Documented From impls in std/sync/mpsc/mod.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
duckymirror committed Sep 20, 2020
1 parent 5e449b9 commit 3f0f409
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 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,9 @@ 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 +1579,9 @@ 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 +1612,9 @@ 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 3f0f409

Please sign in to comment.