MCPcopy Create free account
hub / github.com/deviceplug/btleplug / connect_with_timeout

Method connect_with_timeout

src/api/mod.rs:293–297  ·  view source on GitHub ↗

Like [`connect`](Peripheral::connect), but returns [`Error::TimedOut`](crate::Error::TimedOut) if the connection is not established within the given duration.

(&self, timeout: Duration)

Source from the content-addressed store, hash-verified

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<()>;

Callers 1

find_and_connectFunction · 0.80

Calls 1

connectMethod · 0.45

Tested by

no test coverage detected