Skip to main content

Datastore

Struct Datastore 

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

RAII wrapper around da_datastore — AOCL-DA’s container for tabular data loaded from CSV. Use it to read a file, query its dimensions, label or select columns by name, and extract numeric blocks into caller-provided buffers.

Implementations§

Source§

impl Datastore

Source

pub fn new() -> Result<Self>

Create a fresh empty datastore.

Source

pub fn set_int_option(&mut self, name: &str, value: i64) -> Result<()>

Set an integer-valued datastore option (e.g. set_int_option("use header row", 1), set_int_option("whitespace delimiter", 1)).

Source

pub fn set_string_option(&mut self, name: &str, value: &str) -> Result<()>

Set a string-valued datastore option (e.g. "comment" to set a comment-line prefix character, "storage order" to choose row-major vs column-major).

Source

pub fn load_csv(&mut self, path: &str) -> Result<()>

Load a CSV file into the datastore.

Source

pub fn n_rows(&self) -> Result<usize>

Number of rows currently held by the store.

Source

pub fn n_cols(&self) -> Result<usize>

Number of columns currently held by the store.

Source

pub fn dims(&self) -> Result<(usize, usize)>

(n_rows, n_cols) dimensions.

Source

pub fn select_columns( &mut self, key: &str, lbound: usize, ubound: usize, ) -> Result<()>

Select a contiguous range of columns into the named selection key (zero-based, inclusive bounds). Use Datastore::extract_f64 to read the selected columns into a buffer.

Source

pub fn select_rows( &mut self, key: &str, lbound: usize, ubound: usize, ) -> Result<()>

Select a contiguous range of rows into the named selection key.

Source

pub fn extract_f64( &self, key: &str, layout: Layout, data: &mut [f64], lddata: usize, ) -> Result<()>

Extract the named selection into data as f64 values, in the order specified by layout. lddata is the leading dimension of the output buffer.

Source

pub fn as_raw(&self) -> da_datastore

Borrow the raw da_datastore handle (for routines this crate doesn’t yet wrap).

Trait Implementations§

Source§

impl Debug for Datastore

Source§

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

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

impl Drop for Datastore

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for Datastore

Auto Trait Implementations§

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> 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, 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.