Attempts to encode the batch to a writer.
(&self, out: &mut dyn bytes::BufMut)
| 64 | |
| 65 | /// Attempts to encode the batch to a writer. |
| 66 | pub fn encode(&self, out: &mut dyn bytes::BufMut) -> Result<(), BatchEncodingError> { |
| 67 | match self { |
| 68 | Self::Single(sb) => { |
| 69 | out.put_u8(BatchType::Single as u8); |
| 70 | sb.encode(out); |
| 71 | } |
| 72 | Self::Span(sb) => { |
| 73 | out.put_u8(BatchType::Span as u8); |
| 74 | sb.encode(out).map_err(BatchEncodingError::SpanBatchError)?; |
| 75 | } |
| 76 | } |
| 77 | Ok(()) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | #[cfg(test)] |
no outgoing calls