vortex_schema/
projection.rs1use vortex_dtype::field::Field;
2
3#[derive(Debug, Clone, Default)]
6pub enum Projection {
7 #[default]
8 All,
9 Flat(Vec<Field>),
10}
11
12impl Projection {
13 pub fn new(indices: impl AsRef<[usize]>) -> Self {
14 Self::Flat(indices.as_ref().iter().copied().map(Field::from).collect())
15 }
16}
17
18impl From<Vec<Field>> for Projection {
19 fn from(indices: Vec<Field>) -> Self {
20 Self::Flat(indices)
21 }
22}
23
24impl From<Vec<usize>> for Projection {
25 fn from(indices: Vec<usize>) -> Self {
26 Self::Flat(indices.into_iter().map(Field::from).collect())
27 }
28}