mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +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),
|
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> {
|
impl<T> fmt::Debug for TrySendError<T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match *self {
|
match *self {
|
||||||
@ -123,6 +133,16 @@ cfg_time! {
|
|||||||
Closed(T),
|
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> {
|
impl<T> fmt::Debug for SendTimeoutError<T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match *self {
|
match *self {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user