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)
| 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. |
no test coverage detected