mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
sync: add {TrySendError,SendTimeoutError}::into_inner
(#6755)
This commit is contained in:
parent
0ecf5f0f03
commit
a491b16a89
@ -36,6 +36,16 @@ pub enum TrySendError<T> {
|
||||
Closed(T),
|
||||
}
|
||||
|
||||
impl<T> TrySendError<T> {
|
||||
/// Consume the `TrySendError`, returning the unsent value.
|
||||
pub fn into_inner(self) -> T {
|
||||
match self {
|
||||
TrySendError::Full(val) => val,
|
||||
TrySendError::Closed(val) => val,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> fmt::Debug for TrySendError<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
@ -123,6 +133,16 @@ cfg_time! {
|
||||
Closed(T),
|
||||
}
|
||||
|
||||
impl<T> SendTimeoutError<T> {
|
||||
/// Consume the `SendTimeoutError`, returning the unsent value.
|
||||
pub fn into_inner(self) -> T {
|
||||
match self {
|
||||
SendTimeoutError::Timeout(val) => val,
|
||||
SendTimeoutError::Closed(val) => val,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> fmt::Debug for SendTimeoutError<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user