molframe_core/io/structure_batch_buffer.rs
1//! Exclusive column storage that survives consecutive batch leases.
2
3use super::StructureBatch;
4
5/// Finished structural columns whose backing allocations can be recycled.
6///
7/// The wrapper is deliberately not cloneable: a producer keeps exclusive
8/// access between leases, so resetting a recycled batch never copies columns.
9#[derive(Debug)]
10pub struct StructureBatchBuffer {
11 batch: StructureBatch,
12}
13
14impl StructureBatchBuffer {
15 pub(super) fn new(batch: StructureBatch) -> Self {
16 Self { batch }
17 }
18
19 pub(super) fn batch_mut(&mut self) -> &mut StructureBatch {
20 &mut self.batch
21 }
22
23 /// Borrows the finished immutable batch.
24 #[must_use]
25 pub fn batch(&self) -> &StructureBatch {
26 &self.batch
27 }
28
29 /// Extracts owned columns for a caller that explicitly materialises them.
30 #[must_use]
31 pub fn into_owned(self) -> StructureBatch {
32 self.batch
33 }
34}