mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
committed by
Carl Lerche
parent
516251052d
commit
0651f09427
@@ -241,16 +241,11 @@ impl<T> async_sink::Sink<T> for Sender<T> {
|
||||
|
||||
impl fmt::Display for SendError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::error::Error;
|
||||
write!(fmt, "{}", self.description())
|
||||
write!(fmt, "channel closed")
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::error::Error for SendError {
|
||||
fn description(&self) -> &str {
|
||||
"channel closed"
|
||||
}
|
||||
}
|
||||
impl ::std::error::Error for SendError {}
|
||||
|
||||
// ===== impl TrySendError =====
|
||||
|
||||
@@ -281,19 +276,15 @@ impl<T> TrySendError<T> {
|
||||
|
||||
impl<T: fmt::Debug> fmt::Display for TrySendError<T> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::error::Error;
|
||||
write!(fmt, "{}", self.description())
|
||||
let descr = match self.kind {
|
||||
ErrorKind::Closed => "channel closed",
|
||||
ErrorKind::NoCapacity => "no available capacity",
|
||||
};
|
||||
write!(fmt, "{}", descr)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: fmt::Debug> ::std::error::Error for TrySendError<T> {
|
||||
fn description(&self) -> &str {
|
||||
match self.kind {
|
||||
ErrorKind::Closed => "channel closed",
|
||||
ErrorKind::NoCapacity => "no available capacity",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<T: fmt::Debug> ::std::error::Error for TrySendError<T> {}
|
||||
|
||||
impl<T> From<(T, chan::TrySendError)> for TrySendError<T> {
|
||||
fn from((value, err): (T, chan::TrySendError)) -> TrySendError<T> {
|
||||
@@ -311,13 +302,8 @@ impl<T> From<(T, chan::TrySendError)> for TrySendError<T> {
|
||||
|
||||
impl fmt::Display for RecvError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::error::Error;
|
||||
write!(fmt, "{}", self.description())
|
||||
write!(fmt, "channel closed")
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::error::Error for RecvError {
|
||||
fn description(&self) -> &str {
|
||||
"channel closed"
|
||||
}
|
||||
}
|
||||
impl ::std::error::Error for RecvError {}
|
||||
|
||||
@@ -154,16 +154,11 @@ impl<T> async_sink::Sink<T> for UnboundedSender<T> {
|
||||
|
||||
impl fmt::Display for UnboundedSendError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::error::Error;
|
||||
write!(fmt, "{}", self.description())
|
||||
write!(fmt, "channel closed")
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::error::Error for UnboundedSendError {
|
||||
fn description(&self) -> &str {
|
||||
"channel closed"
|
||||
}
|
||||
}
|
||||
impl ::std::error::Error for UnboundedSendError {}
|
||||
|
||||
// ===== impl TrySendError =====
|
||||
|
||||
@@ -176,16 +171,11 @@ impl<T> UnboundedTrySendError<T> {
|
||||
|
||||
impl<T: fmt::Debug> fmt::Display for UnboundedTrySendError<T> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::error::Error;
|
||||
write!(fmt, "{}", self.description())
|
||||
write!(fmt, "channel closed")
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: fmt::Debug> ::std::error::Error for UnboundedTrySendError<T> {
|
||||
fn description(&self) -> &str {
|
||||
"channel closed"
|
||||
}
|
||||
}
|
||||
impl<T: fmt::Debug> ::std::error::Error for UnboundedTrySendError<T> {}
|
||||
|
||||
impl<T> From<(T, chan::TrySendError)> for UnboundedTrySendError<T> {
|
||||
fn from((value, err): (T, chan::TrySendError)) -> UnboundedTrySendError<T> {
|
||||
@@ -198,13 +188,8 @@ impl<T> From<(T, chan::TrySendError)> for UnboundedTrySendError<T> {
|
||||
|
||||
impl fmt::Display for UnboundedRecvError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::error::Error;
|
||||
write!(fmt, "{}", self.description())
|
||||
write!(fmt, "channel closed")
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::error::Error for UnboundedRecvError {
|
||||
fn description(&self) -> &str {
|
||||
"channel closed"
|
||||
}
|
||||
}
|
||||
impl ::std::error::Error for UnboundedRecvError {}
|
||||
|
||||
@@ -44,31 +44,21 @@ pub mod error {
|
||||
|
||||
impl fmt::Display for RecvError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::error::Error;
|
||||
write!(fmt, "{}", self.description())
|
||||
write!(fmt, "channel closed")
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::error::Error for RecvError {
|
||||
fn description(&self) -> &str {
|
||||
"channel closed"
|
||||
}
|
||||
}
|
||||
impl ::std::error::Error for RecvError {}
|
||||
|
||||
// ===== impl TryRecvError =====
|
||||
|
||||
impl fmt::Display for TryRecvError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::error::Error;
|
||||
write!(fmt, "{}", self.description())
|
||||
write!(fmt, "channel closed")
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::error::Error for TryRecvError {
|
||||
fn description(&self) -> &str {
|
||||
"channel closed"
|
||||
}
|
||||
}
|
||||
impl ::std::error::Error for TryRecvError {}
|
||||
}
|
||||
|
||||
use self::error::*;
|
||||
|
||||
@@ -685,16 +685,11 @@ fn to_try_acquire(_: AcquireError) -> TryAcquireError {
|
||||
|
||||
impl fmt::Display for AcquireError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::error::Error;
|
||||
write!(fmt, "{}", self.description())
|
||||
write!(fmt, "semaphore closed")
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::error::Error for AcquireError {
|
||||
fn description(&self) -> &str {
|
||||
"semaphore closed"
|
||||
}
|
||||
}
|
||||
impl ::std::error::Error for AcquireError {}
|
||||
|
||||
// ===== impl TryAcquireError =====
|
||||
|
||||
@@ -731,19 +726,15 @@ impl TryAcquireError {
|
||||
|
||||
impl fmt::Display for TryAcquireError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::error::Error;
|
||||
write!(fmt, "{}", self.description())
|
||||
let descr = match self.kind {
|
||||
ErrorKind::Closed => "semaphore closed",
|
||||
ErrorKind::NoPermits => "no permits available",
|
||||
};
|
||||
write!(fmt, "{}", descr)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::error::Error for TryAcquireError {
|
||||
fn description(&self) -> &str {
|
||||
match self.kind {
|
||||
ErrorKind::Closed => "semaphore closed",
|
||||
ErrorKind::NoPermits => "no permits available",
|
||||
}
|
||||
}
|
||||
}
|
||||
impl ::std::error::Error for TryAcquireError {}
|
||||
|
||||
// ===== impl WaiterNode =====
|
||||
|
||||
|
||||
@@ -117,16 +117,11 @@ pub mod error {
|
||||
|
||||
impl<T: fmt::Debug> fmt::Display for SendError<T> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::error::Error;
|
||||
write!(fmt, "{}", self.description())
|
||||
write!(fmt, "channel closed")
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: fmt::Debug> ::std::error::Error for SendError<T> {
|
||||
fn description(&self) -> &str {
|
||||
"channel closed"
|
||||
}
|
||||
}
|
||||
impl<T: fmt::Debug> ::std::error::Error for SendError<T> {}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
Reference in New Issue
Block a user