Skip to main content

winget_types/url/
copyright_url.rs

1use 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 CopyrightUrl(DecodedUrl);
9
10impl CopyrightUrl {
11    /// Returns the serialization of this URL.
12    pub fn as_str(&self) -> &str {
13        self.0.as_str()
14    }
15}
16
17impl AsRef<str> for CopyrightUrl {
18    fn as_ref(&self) -> &str {
19        self.0.as_ref()
20    }
21}
22
23impl fmt::Display for CopyrightUrl {
24    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25        self.0.fmt(f)
26    }
27}
28
29impl FromStr for CopyrightUrl {
30    type Err = <DecodedUrl as FromStr>::Err;
31
32    #[inline]
33    fn from_str(src: &str) -> Result<Self, Self::Err> {
34        DecodedUrl::from_str(src).map(Self)
35    }
36}