(
&self,
timeout_after: Duration,
future: impl Future<Output = T>,
)
| 310 | } |
| 311 | |
| 312 | pub async fn timeout<T>( |
| 313 | &self, |
| 314 | timeout_after: Duration, |
| 315 | future: impl Future<Output = T>, |
| 316 | ) -> Result<T, RuntimeTimeout> { |
| 317 | match self { |
| 318 | #[cfg(feature = "tokio")] |
| 319 | Self::Tokio(_) => tokio::time::timeout(timeout_after, future) |
| 320 | .await |
| 321 | .map_err(|_| RuntimeTimeout), |
| 322 | #[cfg(feature = "simulation")] |
| 323 | Self::Simulation(handle) => handle.timeout(timeout_after, future).await.map_err(|_| RuntimeTimeout), |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | pub async fn sleep(&self, duration: Duration) { |
| 328 | match self { |
no outgoing calls