Step the encoder until idle, force-close the current channel, and return all frames from every available submission. Convenience wrapper for tests and one-shot batch pipelines that have already added all blocks via [`BatchPipeline::add_block`] and want all output frames in a single call. # Errors Returns the first [`StepError`] encountered during encoding. On error the encoder state is left as-
(&mut self)
| 147 | /// encoder state is left as-is; previously ready submissions remain available |
| 148 | /// via [`BatchPipeline::next_submission`]. |
| 149 | pub fn encode_and_drain(&mut self) -> Result<Vec<Arc<Frame>>, StepError> { |
| 150 | loop { |
| 151 | match self.step()? { |
| 152 | StepResult::Idle => break, |
| 153 | StepResult::BlockEncoded | StepResult::SpanFlushed | StepResult::ChannelClosed => {} |
| 154 | } |
| 155 | } |
| 156 | self.close_current_channel("force")?; |
| 157 | let mut frames = Vec::new(); |
| 158 | while let Some(sub) = self.next_submission() { |
| 159 | frames.extend(sub.frames); |
| 160 | } |
| 161 | Ok(frames) |
| 162 | } |
| 163 | |
| 164 | /// Build a span batch from the current accumulator. |
| 165 | fn build_span_batch(&self) -> Result<SpanBatch, StepError> { |