ashpd/activation_token/
mod.rs1use std::ops::Deref;
2
3use serde::{Deserialize, Serialize};
4use zbus::zvariant::Type;
5
6#[cfg(any(feature = "gtk4_wayland", feature = "gtk4_x11"))]
7mod gtk4;
8
9#[cfg(feature = "wayland")]
10mod wayland;
11
12#[derive(Debug, Deserialize, Serialize, Type, PartialEq, Eq, Hash, Clone)]
16pub struct ActivationToken(String);
17
18impl From<String> for ActivationToken {
19 fn from(value: String) -> Self {
20 Self(value)
21 }
22}
23
24impl From<&str> for ActivationToken {
25 fn from(value: &str) -> Self {
26 Self(value.to_owned())
27 }
28}
29
30impl From<ActivationToken> for String {
31 fn from(value: ActivationToken) -> String {
32 value.0
33 }
34}
35
36impl Deref for ActivationToken {
37 type Target = str;
38
39 fn deref(&self) -> &Self::Target {
40 self.0.as_str()
41 }
42}
43
44impl AsRef<str> for ActivationToken {
45 fn as_ref(&self) -> &str {
46 self.0.as_str()
47 }
48}
49
50impl std::fmt::Display for ActivationToken {
51 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
52 f.write_str(self.as_ref())
53 }
54}