Returns the next event in the [SendMessageOutput] without consuming it.
(&mut self)
| 575 | |
| 576 | /// Returns the next event in the [SendMessageOutput] without consuming it. |
| 577 | async fn peek(&mut self) -> Result<Option<&ChatResponseStream>, RecvError> { |
| 578 | if self.peek.is_some() { |
| 579 | return Ok(self.peek.as_ref()); |
| 580 | } |
| 581 | match self.next().await? { |
| 582 | Some(v) => { |
| 583 | self.peek = Some(v); |
| 584 | Ok(self.peek.as_ref()) |
| 585 | }, |
| 586 | None => Ok(None), |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | /// Consumes the next [SendMessageOutput] event. |
| 591 | async fn next(&mut self) -> Result<Option<ChatResponseStream>, RecvError> { |
no test coverage detected