1pub use crate::sync::mpsc::{RecvError, RecvTimeoutError, SendError, TryRecvError, TrySendError};
2use crate::{error, fmt};
3
4#[derive(#[automatically_derived]
#[unstable(feature = "mpmc_channel", issue = "126840")]
impl<T: ::core::cmp::PartialEq> ::core::cmp::PartialEq for SendTimeoutError<T>
{
#[inline]
fn eq(&self, other: &SendTimeoutError<T>) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(SendTimeoutError::Timeout(__self_0),
SendTimeoutError::Timeout(__arg1_0)) =>
__self_0 == __arg1_0,
(SendTimeoutError::Disconnected(__self_0),
SendTimeoutError::Disconnected(__arg1_0)) =>
__self_0 == __arg1_0,
_ => unsafe { ::core::intrinsics::unreachable() }
}
}
}PartialEq, #[automatically_derived]
#[unstable(feature = "mpmc_channel", issue = "126840")]
impl<T: ::core::cmp::Eq> ::core::cmp::Eq for SendTimeoutError<T> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) { let _: ::core::cmp::AssertParamIsEq<T>; }
}Eq, #[automatically_derived]
#[unstable(feature = "mpmc_channel", issue = "126840")]
impl<T: ::core::clone::Clone> ::core::clone::Clone for SendTimeoutError<T> {
#[inline]
fn clone(&self) -> SendTimeoutError<T> {
match self {
SendTimeoutError::Timeout(__self_0) =>
SendTimeoutError::Timeout(::core::clone::Clone::clone(__self_0)),
SendTimeoutError::Disconnected(__self_0) =>
SendTimeoutError::Disconnected(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, #[automatically_derived]
#[unstable(feature = "mpmc_channel", issue = "126840")]
impl<T: ::core::marker::Copy> ::core::marker::Copy for SendTimeoutError<T> { }Copy)]
10#[unstable(feature = "mpmc_channel", issue = "126840")]
11pub enum SendTimeoutError<T> {
12 Timeout(T),
17
18 Disconnected(T),
20}
21
22#[unstable(feature = "mpmc_channel", issue = "126840")]
23impl<T> fmt::Debug for SendTimeoutError<T> {
24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25 "SendTimeoutError(..)".fmt(f)
26 }
27}
28
29#[unstable(feature = "mpmc_channel", issue = "126840")]
30impl<T> fmt::Display for SendTimeoutError<T> {
31 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32 match *self {
33 SendTimeoutError::Timeout(..) => "timed out waiting on send operation".fmt(f),
34 SendTimeoutError::Disconnected(..) => "sending on a disconnected channel".fmt(f),
35 }
36 }
37}
38
39#[unstable(feature = "mpmc_channel", issue = "126840")]
40impl<T> error::Error for SendTimeoutError<T> {}
41
42#[unstable(feature = "mpmc_channel", issue = "126840")]
43impl<T> From<SendError<T>> for SendTimeoutError<T> {
44 fn from(err: SendError<T>) -> SendTimeoutError<T> {
45 match err {
46 SendError(e) => SendTimeoutError::Disconnected(e),
47 }
48 }
49}