Struct Database

Source
pub struct Database<Err> { /* private fields */ }
Expand description

Wrapper for IDBDatabase

Implementations§

Source§

impl<Err> Database<Err>

Source

pub fn name(&self) -> String

The name of this database

Internally, this uses IDBDatabase::name.

Source

pub fn version(&self) -> u32

The version of this database, clamped at u32::MAX

Internally, this uses IDBDatabase::version.

Source

pub fn object_store_names(&self) -> Vec<String>

The names of all ObjectStores in this Database

Internally, this uses IDBDatabase::objectStoreNames.

Source

pub fn build_object_store<'a>( &self, name: &'a str, ) -> ObjectStoreBuilder<'a, Err>

Build an ObjectStore

Note that this method can only be called from within an on_upgrade_needed callback. It returns a builder, and calling the create method on this builder will perform the actual creation.

Internally, this uses IDBDatabase::createObjectStore.

Source

pub fn delete_object_store(&self, name: &str) -> Result<(), Err>

Deletes an ObjectStore

Note that this method can only be called from within an on_upgrade_needed callback.

Internally, this uses IDBDatabase::deleteObjectStore.

Source

pub fn transaction(&self, stores: &[&str]) -> TransactionBuilder<Err>

Run a transaction

This will open the object stores identified by stores. See the methods of TransactionBuilder for more details about how transactions actually happen.

Source

pub fn close(&self)

Closes this database connection

Note that the closing will actually happen asynchronously with no way for the client to identify when the database was closed.

Internally, this uses IDBDatabase::close.

Trait Implementations§

Source§

impl<Err: Debug> Debug for Database<Err>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Err> Freeze for Database<Err>

§

impl<Err> RefUnwindSafe for Database<Err>
where Err: RefUnwindSafe,

§

impl<Err> !Send for Database<Err>

§

impl<Err> !Sync for Database<Err>

§

impl<Err> Unpin for Database<Err>
where Err: Unpin,

§

impl<Err> UnwindSafe for Database<Err>
where Err: UnwindSafe,

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.