Skip to main content

Data

Struct Data 

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

Column-major table returned from CCDB fetch operations.

Implementations§

Source§

impl Data

Source

pub fn from_vault( vault: &str, layout: Arc<ColumnLayout>, n_rows: usize, ) -> CCDBResult<Self>

Builds a Data table from a raw vault string and column metadata.

§Errors

This method will return an error if the parsed number of columns does not equal the expected number from the database or if any of the column contents cannot be parsed into their respective data types.

Source

pub fn n_rows(&self) -> usize

Number of rows in the dataset.

Source

pub fn n_columns(&self) -> usize

Number of columns in the dataset.

Source

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

Column names in positional order.

Source

pub fn column_types(&self) -> &[ColumnType]

Column types in positional order.

Source

pub fn column(&self, idx: usize) -> Option<&Column>

Returns a borrowed column by positional index.

Source

pub fn named_column(&self, name: &str) -> Option<&Column>

Returns a borrowed column by name.

Source

pub fn column_clone(&self, idx: usize) -> Option<Column>

Returns a cloned column by positional index.

Source

pub fn named_column_clone(&self, name: &str) -> Option<Column>

Returns a cloned column by name.

Source

pub fn value(&self, column: usize, row: usize) -> Option<Value<'_>>

Returns a single cell value by column and row index.

Source

pub fn named_int(&self, name: &str, row: usize) -> Option<i32>

Returns a named cell as i32 if present and typed accordingly.

Source

pub fn named_uint(&self, name: &str, row: usize) -> Option<u32>

Returns a named cell as u32 if present and typed accordingly.

Source

pub fn named_long(&self, name: &str, row: usize) -> Option<i64>

Returns a named cell as i64 if present and typed accordingly.

Source

pub fn named_ulong(&self, name: &str, row: usize) -> Option<u64>

Returns a named cell as u64 if present and typed accordingly.

Source

pub fn named_double(&self, name: &str, row: usize) -> Option<f64>

Returns a named cell as f64 if present and typed accordingly.

Source

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

Returns a named cell as &str if present and typed accordingly.

Source

pub fn named_bool(&self, name: &str, row: usize) -> Option<bool>

Returns a named cell as bool if present and typed accordingly.

Source

pub fn int(&self, column: usize, row: usize) -> Option<i32>

Returns a positional cell as i32 if present and typed accordingly.

Source

pub fn uint(&self, column: usize, row: usize) -> Option<u32>

Returns a positional cell as u32 if present and typed accordingly.

Source

pub fn long(&self, column: usize, row: usize) -> Option<i64>

Returns a positional cell as i64 if present and typed accordingly.

Source

pub fn ulong(&self, column: usize, row: usize) -> Option<u64>

Returns a positional cell as u64 if present and typed accordingly.

Source

pub fn double(&self, column: usize, row: usize) -> Option<f64>

Returns a positional cell as f64 if present and typed accordingly.

Source

pub fn string(&self, column: usize, row: usize) -> Option<&str>

Returns a positional cell as &str if present and typed accordingly.

Source

pub fn bool(&self, column: usize, row: usize) -> Option<bool>

Returns a positional cell as bool if present and typed accordingly.

Source

pub fn row(&self, row: usize) -> CCDBResult<RowView<'_>>

Returns a borrowed view of a single row, or an error if out of bounds.

§Errors

This method will return an error if row is out of bounds.

Source

pub fn iter_rows(&self) -> impl Iterator<Item = RowView<'_>>

Iterates over all rows in the dataset.

Source

pub fn iter_columns( &self, ) -> impl Iterator<Item = (&String, &ColumnType, &Column)>

Iterates over (name, type, column) tuples for each column.

Source

pub fn contains(&self, name: &str) -> bool

True if a column with the given name exists.

Trait Implementations§

Source§

impl Clone for Data

Source§

fn clone(&self) -> Data

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Data

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Data

§

impl RefUnwindSafe for Data

§

impl Send for Data

§

impl Sync for Data

§

impl Unpin for Data

§

impl UnwindSafe for Data

Blanket Implementations§

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<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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.