(
mut self: Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
)
| 394 | type Item = Result<FlightData>; |
| 395 | |
| 396 | fn poll_next( |
| 397 | mut self: Pin<&mut Self>, |
| 398 | cx: &mut std::task::Context<'_>, |
| 399 | ) -> Poll<Option<Self::Item>> { |
| 400 | loop { |
| 401 | if self.done && self.queue.is_empty() { |
| 402 | return Poll::Ready(None); |
| 403 | } |
| 404 | |
| 405 | // Any messages queued to send? |
| 406 | if let Some(data) = self.queue.pop_front() { |
| 407 | return Poll::Ready(Some(Ok(data))); |
| 408 | } |
| 409 | |
| 410 | // Get next batch |
| 411 | let batch = ready!(self.inner.poll_next_unpin(cx)); |
| 412 | |
| 413 | match batch { |
| 414 | None => { |
| 415 | // inner is done |
| 416 | self.done = true; |
| 417 | // queue must also be empty so we are done |
| 418 | assert!(self.queue.is_empty()); |
| 419 | return Poll::Ready(None); |
| 420 | } |
| 421 | Some(Err(e)) => { |
| 422 | // error from inner |
| 423 | self.done = true; |
| 424 | self.queue.clear(); |
| 425 | return Poll::Ready(Some(Err(e))); |
| 426 | } |
| 427 | Some(Ok(batch)) => { |
| 428 | // had data, encode into the queue |
| 429 | if let Err(e) = self.encode_batch(batch) { |
| 430 | self.done = true; |
| 431 | self.queue.clear(); |
| 432 | return Poll::Ready(Some(Err(e))); |
| 433 | } |
| 434 | } |
| 435 | } |
| 436 | } |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | /// Defines how a [`FlightDataEncoder`] encodes [`DictionaryArray`]s |
nothing calls this directly
no test coverage detected