-
Notifications
You must be signed in to change notification settings - Fork 526
Expand file tree
/
Copy pathsecret.rs
More file actions
45 lines (39 loc) · 1.47 KB
/
secret.rs
File metadata and controls
45 lines (39 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#[cfg(all(
unix,
not(any(target_os = "macos", target_os = "android", target_os = "emscripten")),
))]
use arboard::SetExtLinux;
#[cfg(windows)]
use arboard::SetExtWindows;
#[cfg(target_os = "macos")]
use arboard::SetExtApple;
/// Trait to expose exclude from history functionality from [`arboard`] crate's `SetExt*` extensions.
/// On Linux, it calls [`arboard::SetExtLinux::exclude_from_history`]
/// On MacOS, it calls [`arboard::SetExtApple::exclude_from_history`]
/// On Windows, it calls [`arboard::SetExtWindows::exclude_from_history`], [`arboard::SetExtWindows::exclude_from_cloud`], and [`arboard::SetExtWindows::exclude_from_monitoring`]
pub trait ExcludeSecret<'clipboard> {
fn exclude_secret(self) -> arboard::Set<'clipboard>;
}
#[cfg(all(
unix,
not(any(target_os = "macos", target_os = "android", target_os = "emscripten"))
))]
impl<'clipboard> ExcludeSecret<'clipboard> for arboard::Set<'clipboard> {
fn exclude_secret(self) -> arboard::Set<'clipboard> {
self.exclude_from_history()
}
}
#[cfg(windows)]
impl<'clipboard> ExcludeSecret<'clipboard> for arboard::Set<'clipboard> {
fn exclude_secret(self) -> arboard::Set<'clipboard> {
self.exclude_from_history()
.exclude_from_cloud()
.exclude_from_monitoring()
}
}
#[cfg(target_os = "macos")]
impl<'clipboard> ExcludeSecret<'clipboard> for arboard::Set<'clipboard> {
fn exclude_secret(self) -> arboard::Set<'clipboard> {
self.exclude_from_history()
}
}