pub struct Rows { /* private fields */ }Expand description
Rows held in memory: column names, an optional schema, and the rows.
Implementations§
Source§impl Rows
impl Rows
Sourcepub fn new(columns: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn new(columns: impl IntoIterator<Item = impl Into<String>>) -> Self
No rows under columns.
Sourcepub fn with_schema(self, schema: Schema) -> Self
pub fn with_schema(self, schema: Schema) -> Self
Attach a schema (one field per column).
Sourcepub fn set_schema(&mut self, schema: Option<Schema>)
pub fn set_schema(&mut self, schema: Option<Schema>)
Replace the schema.
Sourcepub fn push(&mut self, row: impl IntoIterator<Item = Value>) -> &mut Self
pub fn push(&mut self, row: impl IntoIterator<Item = Value>) -> &mut Self
Append a row: missing cells are null, and extra cells are dropped.
Sourcepub fn rows_mut(&mut self) -> &mut [Row] ⓘ
pub fn rows_mut(&mut self) -> &mut [Row] ⓘ
The rows, to change in place. Keep one cell per column.
Sourcepub fn column_index(&self, name: &str) -> Option<usize>
pub fn column_index(&self, name: &str) -> Option<usize>
The position of the first column called name.
Sourcepub fn column(&self, index: usize) -> impl Iterator<Item = &Value>
pub fn column(&self, index: usize) -> impl Iterator<Item = &Value>
Every cell of the column at index, top to bottom.
Sourcepub fn into_parts(self) -> (Vec<String>, Option<Schema>, Vec<Row>)
pub fn into_parts(self) -> (Vec<String>, Option<Schema>, Vec<Row>)
The columns, schema and rows.
Sourcepub fn into_source(self) -> RowsSource
pub fn into_source(self) -> RowsSource
A row source over these rows.
Sourcepub fn to_table_data(&self) -> TableData
pub fn to_table_data(&self) -> TableData
A table of these rows: one column per name, numeric columns (by the
schema) right-justified. Sort, group, total or style it with
rich_ext::table.
Trait Implementations§
Source§impl VirtualRows for Rows
impl VirtualRows for Rows
Source§fn row(&self, index: usize) -> Option<Vec<Value>>
fn row(&self, index: usize) -> Option<Vec<Value>>
The row at
index (0-based), or None past the end.Source§fn rows_columns(
&self,
start: usize,
len: usize,
columns: &[usize],
) -> Vec<Vec<Value>>
fn rows_columns( &self, start: usize, len: usize, columns: &[usize], ) -> Vec<Vec<Value>>
Up to
len rows from start, each with only the cells of
columns (0-based, in that order; a cell past the row’s end is
null): what a column window of a
wide table fetches. The default calls rows
and picks the cells; a source that can read some columns without
the rest (a columnar file, a query, cells computed on demand such
as FnCells) overrides it.Auto Trait Implementations§
impl Freeze for Rows
impl RefUnwindSafe for Rows
impl Send for Rows
impl Sync for Rows
impl Unpin for Rows
impl UnsafeUnpin for Rows
impl UnwindSafe for Rows
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more