Skip to main content

tauri_plugin_debug_tools/domain/
models.rs

1use serde::{Deserialize, Serialize};
2use std::path::PathBuf;
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct WebViewState {
6    pub url: String,
7    pub title: String,
8    pub user_agent: String,
9    pub viewport: ViewportInfo,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct ViewportInfo {
14    pub width: u32,
15    pub height: u32,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct ConsoleLogEntry {
20    pub timestamp: i64,
21    pub level: String,
22    pub message: String,
23    pub args: serde_json::Value,
24    pub stack_trace: Option<String>,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct DomState {
29    pub html: String,
30    pub url: String,
31    pub title: String,
32    pub viewport: ViewportInfo,
33    pub captured_at: i64,
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct DebugSnapshot {
38    pub timestamp: i64,
39    pub webview_state: WebViewState,
40    pub console_logs: Vec<ConsoleLogEntry>,
41    pub screenshot_path: Option<PathBuf>,
42    pub dom_snapshot_path: Option<PathBuf>,
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
46pub struct DomSnapshotResult {
47    pub path: PathBuf,
48    pub metadata: DomSnapshotMetadata,
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
52pub struct DomSnapshotMetadata {
53    pub url: String,
54    pub title: String,
55    pub timestamp: i64,
56    pub viewport: ViewportInfo,
57}