winget_types/locale/
moniker.rs1use core::{fmt, ops::Deref, str::FromStr};
2
3use super::{Tag, TagError};
4
5#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7#[cfg_attr(feature = "serde", serde(transparent))]
8#[repr(transparent)]
9pub struct Moniker(Tag);
10
11impl Deref for Moniker {
12 type Target = Tag;
13
14 fn deref(&self) -> &Self::Target {
15 &self.0
16 }
17}
18
19impl fmt::Display for Moniker {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 self.0.fmt(f)
22 }
23}
24
25impl FromStr for Moniker {
26 type Err = TagError;
27
28 fn from_str(s: &str) -> Result<Self, Self::Err> {
29 Tag::from_str(s).map(Self)
30 }
31}