Struct tauri_plugin_store::Builder

source ·
pub struct Builder<R: Runtime> { /* private fields */ }

Implementations§

source§

impl<R: Runtime> Builder<R>

source

pub fn new() -> Self

source

pub fn store(self, store: Store<R>) -> Self

Registers a store with the plugin.

§Examples
use tauri_plugin_store::{StoreBuilder, Builder};

tauri::Builder::default()
  .setup(|app| {
    let store = StoreBuilder::new("store.bin").build(app.handle().clone());
    let builder = Builder::default().store(store);
    Ok(())
  });
source

pub fn stores<T: IntoIterator<Item = Store<R>>>(self, stores: T) -> Self

Registers multiple stores with the plugin.

§Examples
use tauri_plugin_store::{StoreBuilder, Builder};

tauri::Builder::default()
  .setup(|app| {
    let store = StoreBuilder::new("store.bin").build(app.handle().clone());
    let builder = Builder::default().stores([store]);
    Ok(())
  });
source

pub fn freeze(self) -> Self

Freezes the collection.

This causes requests for plugins that haven’t been registered to fail

§Examples
use tauri_plugin_store::{StoreBuilder, Builder};

tauri::Builder::default()
  .setup(|app| {
    let store = StoreBuilder::new("store.bin").build(app.handle().clone());
    app.handle().plugin(Builder::default().freeze().build());
    Ok(())
  });
source

pub fn build(self) -> TauriPlugin<R>

Builds the plugin.

§Examples
use tauri_plugin_store::{StoreBuilder, Builder};

tauri::Builder::default()
  .setup(|app| {
    let store = StoreBuilder::new("store.bin").build(app.handle().clone());
    app.handle().plugin(Builder::default().build());
    Ok(())
  });

Trait Implementations§

source§

impl<R: Runtime> Default for Builder<R>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<R> Freeze for Builder<R>

§

impl<R> !RefUnwindSafe for Builder<R>

§

impl<R> Send for Builder<R>

§

impl<R> Sync for Builder<R>

§

impl<R> Unpin for Builder<R>

§

impl<R> !UnwindSafe for Builder<R>

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

§

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

§

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.