pub struct TidyView { /* private fields */ }Expand description
Zero-copy virtual view over a shared DataFrame.
The base data is behind an Rc and never modified. Filters create bitmasks,
selects narrow projections, sorts store permutation vectors. Data is only
copied when you explicitly materialize or mutate.
Implementations§
Source§impl TidyView
impl TidyView
Sourcepub fn filter(&self, predicate: &DExpr) -> Result<TidyView, TidyError>
pub fn filter(&self, predicate: &DExpr) -> Result<TidyView, TidyError>
Filter rows by predicate. Returns a new TidyView with an updated bitmask. No data is copied — just bits are flipped.
Sourcepub fn select(&self, cols: &[&str]) -> Result<TidyView, TidyError>
pub fn select(&self, cols: &[&str]) -> Result<TidyView, TidyError>
Select specific columns by name. Returns a new TidyView with a narrowed projection. No data is copied.
Sourcepub fn mutate(
&self,
assignments: &[(&str, DExpr)],
) -> Result<DataFrame, TidyError>
pub fn mutate( &self, assignments: &[(&str, DExpr)], ) -> Result<DataFrame, TidyError>
Add or replace columns. Materializes the view and returns a new DataFrame.
Uses snapshot semantics: all column references resolve against the column list frozen before any assignments execute.
Sourcepub fn group_by(&self, keys: &[&str]) -> Result<GroupedTidyView, TidyError>
pub fn group_by(&self, keys: &[&str]) -> Result<GroupedTidyView, TidyError>
Group rows by one or more key columns.
Groups appear in first-occurrence order (deterministic, not hash-dependent).
Sourcepub fn arrange(&self, keys: &[ArrangeKey]) -> Result<TidyView, TidyError>
pub fn arrange(&self, keys: &[ArrangeKey]) -> Result<TidyView, TidyError>
Sort visible rows by one or more keys. Stores the result as a lazy permutation vector — no data is materialized.
Sourcepub fn slice_head(&self, n: usize) -> TidyView
pub fn slice_head(&self, n: usize) -> TidyView
Take the first N visible rows.
Sourcepub fn slice_tail(&self, n: usize) -> TidyView
pub fn slice_tail(&self, n: usize) -> TidyView
Take the last N visible rows.
Sourcepub fn slice_sample(&self, n: usize, seed: u64) -> TidyView
pub fn slice_sample(&self, n: usize, seed: u64) -> TidyView
Deterministic random sample of N rows. Same seed = same rows, always.
Sourcepub fn distinct(&self, cols: &[&str]) -> Result<TidyView, TidyError>
pub fn distinct(&self, cols: &[&str]) -> Result<TidyView, TidyError>
Keep only unique rows by the given column subset.
Sourcepub fn inner_join(
&self,
right: &TidyView,
on: &[(&str, &str)],
) -> Result<DataFrame, TidyError>
pub fn inner_join( &self, right: &TidyView, on: &[(&str, &str)], ) -> Result<DataFrame, TidyError>
Inner join: rows where keys match in both tables.
Sourcepub fn left_join(
&self,
right: &TidyView,
on: &[(&str, &str)],
) -> Result<DataFrame, TidyError>
pub fn left_join( &self, right: &TidyView, on: &[(&str, &str)], ) -> Result<DataFrame, TidyError>
Left join: all left rows, matched right rows or defaults.
Sourcepub fn materialize(&self) -> Result<DataFrame, TidyError>
pub fn materialize(&self) -> Result<DataFrame, TidyError>
Materialize the view into a new DataFrame (mask + projection applied).
Sourcepub fn column_names(&self) -> Vec<String>
pub fn column_names(&self) -> Vec<String>
Column names visible through the current projection.