pub trait TableView {
// Required methods
fn schema(&self) -> &CausalSchema;
fn row_count(&self) -> usize;
fn column(&self, id: VariableId) -> Result<ColumnView<'_>, DataError>;
// Provided methods
fn float64_slice(&self, id: VariableId) -> Result<&[f64], DataError> { ... }
fn float64_cow(&self, id: VariableId) -> Result<Cow<'_, [f64]>, DataError> { ... }
fn float64_values(&self, id: VariableId) -> Result<Vec<f64>, DataError> { ... }
}Expand description
Borrowed table access used by algorithms.
Required Methods§
Sourcefn schema(&self) -> &CausalSchema
fn schema(&self) -> &CausalSchema
Immutable causal schema.
Sourcefn column(&self, id: VariableId) -> Result<ColumnView<'_>, DataError>
fn column(&self, id: VariableId) -> Result<ColumnView<'_>, DataError>
Provided Methods§
Sourcefn float64_slice(&self, id: VariableId) -> Result<&[f64], DataError>
fn float64_slice(&self, id: VariableId) -> Result<&[f64], DataError>
Borrow a native Float64 column as a contiguous slice (no allocation).
Unlike TableView::float64_values, no coercion is attempted: Int64
and Boolean columns error so callers stay on the copying path for
them. Use TableView::float64_cow to get borrowed-when-possible
semantics with the same values as float64_values.
§Errors
Unknown variable or non-Float64 column type.
Sourcefn float64_cow(&self, id: VariableId) -> Result<Cow<'_, [f64]>, DataError>
fn float64_cow(&self, id: VariableId) -> Result<Cow<'_, [f64]>, DataError>
Column values as f64, borrowed when the column is native Float64.
Yields exactly the same values as TableView::float64_values
(including the Int64/Boolean coercions), but avoids the copy for
native Float64 columns.
§Errors
Unknown variable or unsupported column type.
Sourcefn float64_values(&self, id: VariableId) -> Result<Vec<f64>, DataError>
fn float64_values(&self, id: VariableId) -> Result<Vec<f64>, DataError>
Copy a column into an owned f64 buffer.
Native Float64 columns are copied as-is. Int64 and Boolean columns
are coerced to f64 (true → 1.0, false → 0.0); invalid rows become
NaN. Other column kinds (categorical, timestamp, fixed vector) error.
§Errors
Unknown variable or unsupported column type.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".