X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=library%2Fstd%2Fsrc%2Fsync%2Fmpsc%2Fmod.rs;h=6e3c28f10bb1ba9e31298fa90d34b54029ae32bd;hb=8ea26ca17f1baf0877b7b249323f3d5d72f0d3b4;hp=adb488d4378f0391140e6eadf604603720f8776f;hpb=bd20fc1fd657b32f7aa1d70d8723f04c87f21606;p=rust.git diff --git a/library/std/src/sync/mpsc/mod.rs b/library/std/src/sync/mpsc/mod.rs index adb488d4378..6e3c28f10bb 100644 --- a/library/std/src/sync/mpsc/mod.rs +++ b/library/std/src/sync/mpsc/mod.rs @@ -738,6 +738,15 @@ pub fn send(&self, t: T) -> Result<(), SendError> { pub fn try_send(&self, t: T) -> Result<(), TrySendError> { self.inner.try_send(t) } + + // Attempts to send for a value on this receiver, returning an error if the + // corresponding channel has hung up, or if it waits more than `timeout`. + // + // This method is currently private and only used for tests. + #[allow(unused)] + fn send_timeout(&self, t: T, timeout: Duration) -> Result<(), mpmc::SendTimeoutError> { + self.inner.send_timeout(t, timeout) + } } #[stable(feature = "rust1", since = "1.0.0")]