(&self)
| 155 | /// it is guaranteed that no messages were received on this channel. |
| 156 | #[expect(clippy::missing_panics_doc, reason = "not handling poisoned mutex")] |
| 157 | pub async fn recv(&self) -> Result<T, BufferClosedError> { |
| 158 | // loop to check values, then await for notification, then get value again |
| 159 | loop { |
| 160 | { |
| 161 | // brace drops guard |
| 162 | let mut guard = self.inner.lock().unwrap(); |
| 163 | if guard.sender_dropped { |
| 164 | return Err(BufferClosedError); |
| 165 | } |
| 166 | if let Some(Side::Sender) = guard.disruption_handled { |
| 167 | // it's a bug for this to repeatedly fire from the same channel |
| 168 | tracing::debug!("Receiving when sender handled disruption"); |
| 169 | } |
| 170 | if let Some(value) = guard.pop() { |
| 171 | return Ok(value); |
| 172 | } |
| 173 | } |
| 174 | self.notifiee.notified().await; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | /// Handle a clock disruption event |
| 179 | /// |
no test coverage detected