After some discussion with PVH I realise that the repo structure in the last reorg was very rust-centric. In an attempt to put each language on a level footing move the rust code and project files into ./rust
42 lines
1 KiB
Rust
42 lines
1 KiB
Rust
use std::ops::Range;
|
|
|
|
use crate::columnar::column_range::generic::GenericColumnRange;
|
|
|
|
use super::{ColumnId, ColumnSpec, ColumnType};
|
|
|
|
/// A combination of a column specification and the range of data associated with it. Note that
|
|
/// multiple (adjacent) ranges can be associated with one column as some columns are composite.
|
|
/// This is encapsulated in the `GenericColumnRange` type.
|
|
#[derive(Clone, Debug)]
|
|
pub(crate) struct Column {
|
|
spec: ColumnSpec,
|
|
range: GenericColumnRange,
|
|
}
|
|
|
|
impl Column {
|
|
pub(crate) fn new(spec: ColumnSpec, range: GenericColumnRange) -> Column {
|
|
Self { spec, range }
|
|
}
|
|
}
|
|
|
|
impl Column {
|
|
pub(crate) fn range(&self) -> Range<usize> {
|
|
self.range.range()
|
|
}
|
|
|
|
pub(crate) fn into_ranges(self) -> GenericColumnRange {
|
|
self.range
|
|
}
|
|
|
|
pub(crate) fn col_type(&self) -> ColumnType {
|
|
self.spec.col_type()
|
|
}
|
|
|
|
pub(crate) fn id(&self) -> ColumnId {
|
|
self.spec.id()
|
|
}
|
|
|
|
pub(crate) fn spec(&self) -> ColumnSpec {
|
|
self.spec
|
|
}
|
|
}
|