From 9f356d62443210277758c63a7ee816a78965b54a Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Tue, 22 Jan 2019 14:48:22 -0800 Subject: [PATCH] tokio-sync: add into_inner for TrySendErrors (#862) --- tokio-sync/src/mpsc/bounded.rs | 7 +++++++ tokio-sync/src/mpsc/unbounded.rs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/tokio-sync/src/mpsc/bounded.rs b/tokio-sync/src/mpsc/bounded.rs index 49734186a..d74317316 100644 --- a/tokio-sync/src/mpsc/bounded.rs +++ b/tokio-sync/src/mpsc/bounded.rs @@ -214,6 +214,13 @@ impl ::std::error::Error for SendError { // ===== impl TrySendError ===== +impl TrySendError { + /// Get the inner value. + pub fn into_inner(self) -> T { + self.value + } +} + impl fmt::Display for TrySendError { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { use std::error::Error; diff --git a/tokio-sync/src/mpsc/unbounded.rs b/tokio-sync/src/mpsc/unbounded.rs index 33419d4ac..957336517 100644 --- a/tokio-sync/src/mpsc/unbounded.rs +++ b/tokio-sync/src/mpsc/unbounded.rs @@ -136,6 +136,13 @@ impl ::std::error::Error for UnboundedSendError { // ===== impl TrySendError ===== +impl UnboundedTrySendError { + /// Get the inner value. + pub fn into_inner(self) -> T { + self.0 + } +} + impl fmt::Display for UnboundedTrySendError { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { use std::error::Error;