Like [`connect`](Peripheral::connect), but returns [`Error::TimedOut`](crate::Error::TimedOut) if the connection is not established within the given duration.
(&self, timeout: Duration)
| 291 | /// Like [`connect`](Peripheral::connect), but returns [`Error::TimedOut`](crate::Error::TimedOut) |
| 292 | /// if the connection is not established within the given duration. |
| 293 | async fn connect_with_timeout(&self, timeout: Duration) -> Result<()> { |
| 294 | tokio::time::timeout(timeout, self.connect()) |
| 295 | .await |
| 296 | .map_err(|_| crate::Error::TimedOut(timeout))? |
| 297 | } |
| 298 | |
| 299 | /// Terminates a connection to the device. |
| 300 | async fn disconnect(&self) -> Result<()>; |
no test coverage detected