utility_cli_rs/types/
url.rs1#[derive(Debug, Clone)]
2pub struct Url(pub url::Url);
3
4impl From<Url> for url::Url {
5 fn from(url: Url) -> Self {
6 url.0
7 }
8}
9
10impl From<url::Url> for Url {
11 fn from(url: url::Url) -> Self {
12 Self(url)
13 }
14}
15
16impl std::fmt::Display for Url {
17 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18 self.0.fmt(f)
19 }
20}
21
22impl std::str::FromStr for Url {
23 type Err = url::ParseError;
24
25 fn from_str(s: &str) -> Result<Self, Self::Err> {
26 let url = url::Url::parse(s)?;
27 Ok(Self(url))
28 }
29}
30
31impl interactive_clap::ToCli for Url {
32 type CliVariant = Url;
33}