Introduce unified Series trait

This commit introduces the `Series` trait to provide a unified interface
for accessing indexed data across different series types (RecordSeries,
SeriesView, and future SharedSeries). This simplifies the VM's indexer
logic and lays the groundwork for the dual series architecture.
This commit is contained in:
Michael Schimmel
2026-03-01 21:24:42 +01:00
parent fc858de59c
commit b74ddcfd61
3 changed files with 38 additions and 24 deletions
+12
View File
@@ -180,6 +180,18 @@ impl RecordLayout {
pub trait Object: fmt::Debug {
fn type_name(&self) -> &'static str;
fn as_any(&self) -> &dyn Any;
/// Optional optimization: If this object behaves like a time series (indexable lookbacks),
/// it can return a reference to its Series trait implementation.
fn as_series(&self) -> Option<&dyn Series> {
None
}
}
/// Unified interface for all series types (Local RecordSeries, SeriesViews, and future SharedSeries).
pub trait Series {
/// Gets the value at the specified lookback index (0 = newest).
fn get_item(&self, index: usize) -> Option<Value>;
}
/// A shared sequence of values, used by both Tuples and Records.