SqliteDatasetStorage

Struct SqliteDatasetStorage 

Source
pub struct SqliteDatasetStorage { /* private fields */ }
Available on crate features sqlite or sqlite-bundled only.
Expand description

The SqliteDatasetStorage struct represents a SQLite database for storing datasets. It consists of an optional name, a database file path, and a base directory for storage.

Implementations§

Source§

impl SqliteDatasetStorage

Source

pub fn from_name(name: &str) -> Self

Creates a new instance of SqliteDatasetStorage using a dataset name.

§Arguments
  • name - A string slice that holds the name of the dataset.
Source

pub fn from_file<P: AsRef<Path>>(db_file: P) -> Self

Creates a new instance of SqliteDatasetStorage using a database file path.

§Arguments
  • db_file - A reference to the Path that represents the database file path.
Source

pub fn with_base_dir<P: AsRef<Path>>(self, base_dir: P) -> Self

Sets the base directory for storing the dataset.

§Arguments
  • base_dir - A string slice that represents the base directory.
Source

pub fn exists(&self) -> bool

Checks if the database file exists in the given path.

§Returns
  • A boolean value indicating whether the file exists or not.
Source

pub fn db_file(&self) -> PathBuf

Fetches the database file path.

§Returns
  • A PathBuf instance representing the file path.
Source

pub fn base_dir(base_dir: Option<PathBuf>) -> PathBuf

Determines the base directory for storing the dataset.

§Arguments
  • base_dir - An Option that may contain a PathBuf instance representing the base directory.
§Returns
  • A PathBuf instance representing the base directory.
Source

pub fn writer<I>(&self, overwrite: bool) -> Result<SqliteDatasetWriter<I>>

Provides a writer instance for the SQLite dataset.

§Arguments
  • overwrite - A boolean indicating if the existing database file should be overwritten.
§Returns
  • A Result which is Ok if the writer could be created, Err otherwise.
Source

pub fn reader<I>(&self, split: &str) -> Result<SqliteDataset<I>>

Provides a reader instance for the SQLite dataset.

§Arguments
  • split - A string slice that defines the data split for reading (e.g., “train”, “test”).
§Returns
  • A Result which is Ok if the reader could be created, Err otherwise.

Trait Implementations§

Source§

impl Clone for SqliteDatasetStorage

Source§

fn clone(&self) -> SqliteDatasetStorage

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 SqliteDatasetStorage

Source§

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

Formats the value using the given formatter. Read more

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> 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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V