Skip to main content

model/
data.rs

1//! Data containers — role-agnostic column storage definitions.
2//!
3//! Role assignment (X / Y / X-error / Y-error) lives in
4//! [`crate::data_config::SeriesConfig`]; `Column` / `DataCell` themselves are
5//! role-agnostic. The upload adapter (`ColumnSource`) is the renderer's
6//! concern and lives in the renderer crate.
7
8/// Identifier under which a column is registered in a column store (e.g. the
9/// renderer's GPU column pool). Plain `String` — interning is the store's job.
10pub type ColumnId = String;
11
12/// A bundle of columns belonging to one logical data source.
13#[derive(Debug, Clone, PartialEq)]
14pub struct DataCell<T> {
15    pub data_id: String,
16    pub columns: Vec<Column<T>>,
17}
18
19/// A single column: data + cached min/max.
20///
21/// The role (axis or errorbar) is not encoded here — `SeriesConfig.x_column /
22/// y_column` and `DataRenderType`'s `ErrorRef` reference columns by id.
23#[derive(Debug, Clone, PartialEq)]
24pub struct Column<T> {
25    pub data: Vec<T>,
26    pub min: T,
27    pub max: T,
28}