(&mut self)
| 132 | } |
| 133 | |
| 134 | pub async fn recv_cmd(&mut self) -> anyhow::Result<FifoCommand> { |
| 135 | let bytes = self |
| 136 | .ctl_reader |
| 137 | .next() |
| 138 | .await |
| 139 | .ok_or_else(|| anyhow::anyhow!("FIFO stream closed"))??; |
| 140 | |
| 141 | let decoded = bincode::deserialize(&bytes) |
| 142 | .with_context(|| format!("Failed to deserialize FIFO command (data: {bytes:?})"))?; |
| 143 | Ok(decoded) |
| 144 | } |
| 145 | |
| 146 | pub async fn send_cmd(&mut self, cmd: FifoCommand) -> anyhow::Result<()> { |
| 147 | let encoded = bincode::serialize(&cmd)?; |
no test coverage detected