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

Method set_reply

src/corebluetooth/future.rs:40–51  ·  view source on GitHub ↗

Sets the reply message in a message state struct, firing the waker. When a reply is received from (or in the in-process case, generated by) a server, this function takes the message, updates the state struct, and calls [Waker::wake] so that the corresponding future can finish. # Parameters - `msg`: Message to set as reply, which will be returned by the corresponding future.

(&mut self, reply: T)

Source from the content-addressed store, hash-verified

38 /// - `msg`: Message to set as reply, which will be returned by the
39 /// corresponding future.
40 pub fn set_reply(&mut self, reply: T) {
41 if self.reply_msg.is_some() {
42 // TODO Can we stop multiple calls to set_reply_msg at compile time?
43 panic!("set_reply_msg called multiple times on the same future.");
44 }
45
46 self.reply_msg = Some(reply);
47
48 if self.waker.is_some() {
49 self.waker.take().unwrap().wake();
50 }
51 }
52}
53
54/// Shared [BtlePlugFutureState] type.

Callers 15

check_discoveredMethod · 0.80
confirm_disconnectMethod · 0.80
on_peripheral_connectMethod · 0.80
is_connectedMethod · 0.80
write_valueMethod · 0.80
on_read_rssiMethod · 0.80

Calls 2

takeMethod · 0.80
wakeMethod · 0.45

Tested by

no test coverage detected