vortex_layout/layouts/struct_/
reader.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use vortex_array::ContextRef;
use vortex_error::{vortex_panic, VortexResult};

use crate::layouts::struct_::StructLayout;
use crate::{LayoutData, LayoutEncoding, LayoutReader};

#[derive(Debug)]
pub struct StructScan {
    layout: LayoutData,
}

impl StructScan {
    pub(super) fn try_new(layout: LayoutData, _ctx: ContextRef) -> VortexResult<Self> {
        if layout.encoding().id() != StructLayout.id() {
            vortex_panic!("Mismatched layout ID")
        }

        // This is where we need to do some complex things with the scan in order to split it into
        // different scans for different fields.
        Ok(Self { layout })
    }
}

impl LayoutReader for StructScan {
    fn layout(&self) -> &LayoutData {
        &self.layout
    }
}