winget_types/url/
publisher_url.rs1use core::{fmt, str::FromStr};
2
3use super::DecodedUrl;
4
5#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Ord, Hash)]
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7#[cfg_attr(feature = "serde", serde(transparent))]
8pub struct PublisherUrl(DecodedUrl);
9
10impl PublisherUrl {
11 #[inline]
13 pub fn as_str(&self) -> &str {
14 self.0.as_str()
15 }
16}
17
18impl AsRef<str> for PublisherUrl {
19 fn as_ref(&self) -> &str {
20 self.0.as_ref()
21 }
22}
23
24impl fmt::Display for PublisherUrl {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 self.0.fmt(f)
27 }
28}
29
30impl FromStr for PublisherUrl {
31 type Err = <DecodedUrl as FromStr>::Err;
32
33 fn from_str(src: &str) -> Result<Self, <DecodedUrl as FromStr>::Err> {
34 DecodedUrl::from_str(src).map(Self)
35 }
36}