Skip to main content

Rows

Struct Rows 

Source
pub struct Rows { /* private fields */ }
Expand description

Rows held in memory: column names, an optional schema, and the rows.

Implementations§

Source§

impl Rows

Source

pub fn new(columns: impl IntoIterator<Item = impl Into<String>>) -> Self

No rows under columns.

Source

pub fn with_schema(self, schema: Schema) -> Self

Attach a schema (one field per column).

Source

pub fn set_schema(&mut self, schema: Option<Schema>)

Replace the schema.

Source

pub fn push(&mut self, row: impl IntoIterator<Item = Value>) -> &mut Self

Append a row: missing cells are null, and extra cells are dropped.

Source

pub fn columns(&self) -> &[String]

The column names.

Source

pub fn schema(&self) -> Option<&Schema>

The schema, if any.

Source

pub fn rows(&self) -> &[Row] ⓘ

The rows, in order.

Source

pub fn rows_mut(&mut self) -> &mut [Row] ⓘ

The rows, to change in place. Keep one cell per column.

Source

pub fn len(&self) -> usize

The number of rows.

Source

pub fn is_empty(&self) -> bool

Whether there are no rows.

Source

pub fn column_index(&self, name: &str) -> Option<usize>

The position of the first column called name.

Source

pub fn column(&self, index: usize) -> impl Iterator<Item = &Value>

Every cell of the column at index, top to bottom.

Source

pub fn into_parts(self) -> (Vec<String>, Option<Schema>, Vec<Row>)

The columns, schema and rows.

Source

pub fn into_source(self) -> RowsSource

A row source over these rows.

Source

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 Clone for Rows

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Rows

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Rows

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl VirtualRows for Rows

Source§

fn row_count(&self) -> Option<usize>

How many rows there are, when the source knows.
Source§

fn row(&self, index: usize) -> Option<Vec<Value>>

The row at index (0-based), or None past the end.
Source§

fn rows(&self, start: usize, len: usize) -> Vec<Vec<Value>>

Up to len rows from start, fewer at the end. The default calls row until it returns None.

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§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.