tauri-plugin-valtio 0.0.2

Persistent valtio stores for Tauri
Documentation
// This file was autogenerated and should not be edited manually.
// Check the `codegen` command in the `tauri-store-cli` crate.

use crate::valtio::Valtio;
use tauri::{AppHandle, Manager, Runtime, State, WebviewWindow, Window};

/// Extension for the [`Manager`](tauri::Manager) trait providing access to the Valtio plugin.
pub trait ManagerExt<R: Runtime>: Manager<R> {
  /// Returns a handle to the Valtio plugin.
  ///
  /// # Panics
  ///
  /// Panics if the internal [store collection](tauri_store::StoreCollection) is not in the [resources table](tauri::ResourceTable).
  ///
  /// This likely indicates that the method was called before the plugin was properly initialized.
  fn valtio(&self) -> State<Valtio<R>> {
    self.state::<Valtio<R>>()
  }
}

impl<R: Runtime> ManagerExt<R> for AppHandle<R> {}
impl<R: Runtime> ManagerExt<R> for WebviewWindow<R> {}
impl<R: Runtime> ManagerExt<R> for Window<R> {}