Skip to main content

SqliteBackend

Struct SqliteBackend 

Source
pub struct SqliteBackend { /* private fields */ }

Implementations§

Source§

impl SqliteBackend

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, BackendError>

Opens a connection to the SQLite database.

Uses SqliteOptions::default for SQLite pragmas and cross-process change detection.

§Errors

Returns BackendError::Open when the database cannot be opened, SQLite pragmas cannot be applied, or the settings table cannot be created.

Source

pub fn open_with_options( path: impl AsRef<Path>, options: SqliteOptions, ) -> Result<Self, BackendError>

Opens a connection to the SQLite database with explicit backend options.

Applies the configured SQLite pragmas, creates the settings table, and starts the cross-process watcher when options.cross_process is true.

§Errors

Returns BackendError::Open when the database cannot be opened, SQLite pragmas cannot be applied, or the settings table cannot be created.

Trait Implementations§

Source§

impl Drop for SqliteBackend

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 StorageBackend for SqliteBackend

Source§

fn load_all(&self) -> Result<HashMap<String, StoredValue>, BackendError>

Load all persisted settings into memory. This method is called at load and on watcher ticks.
Source§

fn set(&self, key: &str, value: &StoredValue) -> Result<(), BackendError>

Persist a setting to the database. Read more
Source§

fn delete(&self, key: &str) -> Result<(), BackendError>

Remove a setting from the database. Read more
Source§

fn watch_changes(&self) -> Option<Receiver<()>>

Subscribe to the backend storage event stream. Default returns None. The returned receiver fires for every change, including own-process writes.

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