tauri_plugin_wallpaper/
models.rs

1use serde::{Deserialize, Serialize};
2use tauri::WebviewWindow;
3
4#[derive(Debug, Deserialize, Serialize)]
5#[serde(rename_all = "camelCase")]
6pub struct AttachRequest {
7    pub window_label: String,
8}
9
10impl AttachRequest {
11    pub fn new(window_label: &str) -> Self {
12        Self {
13            window_label: window_label.to_string(),
14        }
15    }
16    pub fn from_webview_window(webview_window: WebviewWindow) -> Self {
17        Self {
18            window_label: webview_window.label().to_string(),
19        }
20    }
21}
22
23#[derive(Debug, Deserialize, Serialize)]
24#[serde(rename_all = "camelCase")]
25pub struct DetachRequest {
26    pub window_label: String,
27}
28
29impl DetachRequest {
30    pub fn new(window_label: &str) -> Self {
31        Self {
32            window_label: window_label.to_string(),
33        }
34    }
35    pub fn from_webview_window(webview_window: WebviewWindow) -> Self {
36        Self {
37            window_label: webview_window.label().to_string(),
38        }
39    }
40}