1use serde::{Deserialize, Serialize};
8use std::fmt;
9
10#[derive(Clone, Debug, Default, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
17#[serde(transparent)]
18pub struct AppId(String);
19
20impl AppId {
21 #[must_use]
22 pub const fn owned(value: String) -> Self {
23 Self(value)
24 }
25
26 #[must_use]
27 pub const fn as_str(&self) -> &str {
28 self.0.as_str()
29 }
30}
31
32impl AsRef<str> for AppId {
33 fn as_ref(&self) -> &str {
34 self.as_str()
35 }
36}
37
38impl fmt::Display for AppId {
39 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
40 formatter.write_str(self.as_str())
41 }
42}
43
44impl From<&str> for AppId {
45 fn from(value: &str) -> Self {
46 Self(value.to_string())
47 }
48}
49
50impl From<String> for AppId {
51 fn from(value: String) -> Self {
52 Self::owned(value)
53 }
54}