feat(clipboard): add plugin (#323)

This commit is contained in:
Lucas Fernandes Nogueira
2023-04-18 06:19:45 -07:00
committed by GitHub
parent 4539c03f95
commit 8cd7d3501b
37 changed files with 4679 additions and 22 deletions
+3
View File
@@ -7,6 +7,9 @@ license.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build.workspace = true
[dependencies]
serde.workspace = true
serde_json.workspace = true
+2 -4
View File
@@ -2,16 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri::{AppHandle, command, Runtime, State, Window};
use tauri::{AppHandle, command, Runtime, Window};
use crate::{MyState, Result};
use crate::Result;
#[command]
pub(crate) async fn execute<R: Runtime>(
_app: AppHandle<R>,
_window: Window<R>,
state: State<'_, MyState>,
) -> Result<String> {
state.0.lock().unwrap().insert("key".into(), "value".into());
Ok("success".to_string())
}
-5
View File
@@ -7,8 +7,6 @@ use tauri::{
Manager, Runtime,
};
use std::{collections::HashMap, sync::Mutex};
pub use models::*;
#[cfg(desktop)]
@@ -27,9 +25,6 @@ use desktop::{{ plugin_name_pascal_case }};
#[cfg(mobile)]
use mobile::{{ plugin_name_pascal_case }};
#[derive(Default)]
struct MyState(Mutex<HashMap<String, String>>);
/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the {{ plugin_name }} APIs.
pub trait {{ plugin_name_pascal_case }}Ext<R: Runtime> {
fn {{ plugin_name_snake_case }}(&self) -> &{{ plugin_name_pascal_case }}<R>;