tauri_plugin_ios_bookmark/
models.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4#[serde(rename_all = "camelCase")]
5pub struct PickBookmarkRequest {
6 #[serde(skip_serializing_if = "Option::is_none")]
7 pub target_path: Option<String>,
8 #[serde(skip_serializing_if = "Option::is_none")]
9 pub suggested_file_name: Option<String>,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
14#[serde(rename_all = "camelCase")]
15pub struct PickResult {
16 pub bookmark_id: String,
18 pub file_name: String,
20 pub file_path: String,
22 pub content: String,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(rename_all = "camelCase")]
29pub struct ReadResult {
30 pub file_name: String,
31 pub content: String,
32}
33
34#[derive(Debug, thiserror::Error)]
35pub enum BookmarkError {
36 #[error("security-scoped bookmarks are not supported on this platform")]
37 Unsupported,
38 #[error("bookmark not found: {0}")]
39 NotFound(String),
40 #[error("bookmark is stale — user must re-pick the file")]
41 Stale,
42 #[error("access denied")]
43 PermissionDenied,
44 #[error("I/O error: {0}")]
45 Io(String),
46 #[error("cancelled")]
47 Cancelled,
48 #[error("selected file does not match requested target")]
49 TargetMismatch,
50 #[error("native error: {0}")]
51 Native(String),
52}
53
54impl serde::Serialize for BookmarkError {
55 fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
56 s.serialize_str(&self.to_string())
57 }
58}