summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2023-04-12 12:47:53 +0000
committerGitHub <noreply@github.com>2023-04-12 12:47:53 +0000
commitcc3c0476b39cf77ad7588037381047d6f45d248f (patch)
tree6db70c26283222ab1ca34fa60d9c6afeed461d1a
parentf63403b285127f7acccd613ba5e9112e4663ea6d (diff)
parentaceae1001ee551c8a28a75faba7cf835ff84666c (diff)
Merge #158
158: Impl (feature gated) AsTypeDescription for url::Url r=TheNeikos a=matthiasbeyer This PR implements (feature gated) `AsTypeDescription` for the `url::Url` type. Co-authored-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--Cargo.lock67
-rw-r--r--Cargo.toml3
-rw-r--r--src/lib.rs3
3 files changed, 73 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock
index c863615..91fd869 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -176,6 +176,15 @@ dependencies = [
]
[[package]]
+name = "form_urlencoded"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
+dependencies = [
+ "percent-encoding",
+]
+
+[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -200,6 +209,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
[[package]]
+name = "idna"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
+dependencies = [
+ "unicode-bidi",
+ "unicode-normalization",
+]
+
+[[package]]
name = "indexmap"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -296,6 +315,12 @@ dependencies = [
]
[[package]]
+name = "percent-encoding"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
+
+[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -426,6 +451,21 @@ dependencies = [
]
[[package]]
+name = "tinyvec"
+version = "1.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
+[[package]]
name = "trybuild"
version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -450,6 +490,7 @@ dependencies = [
"serde_json",
"trybuild",
"type_description_derive",
+ "url",
]
[[package]]
@@ -463,6 +504,12 @@ dependencies = [
]
[[package]]
+name = "unicode-bidi"
+version = "0.3.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
+
+[[package]]
name = "unicode-id"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -475,6 +522,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7"
[[package]]
+name = "unicode-normalization"
+version = "0.1.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
+dependencies = [
+ "tinyvec",
+]
+
+[[package]]
+name = "url"
+version = "2.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
+dependencies = [
+ "form_urlencoded",
+ "idna",
+ "percent-encoding",
+]
+
+[[package]]
name = "utf8parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 4b0236e..6527e8c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,6 +21,7 @@ required-features = ["bin"]
default = ["render"]
render = ["indexmap"]
bin = ["clap", "serde_json"]
+url = ["dep:url"]
[dependencies]
clap = { version = "4.2.1", features = ["derive"], optional = true }
@@ -29,6 +30,8 @@ serde = { version = "1.0.159", features = ["derive"] }
serde_json = { version = "1.0.95", optional = true }
type_description_derive = { version = "0.3.0", path = "type_description_derive" }
+url = { version = "2", optional = true }
+
[dev-dependencies]
serde = { version = "1.0.159", features = ["derive"] }
serde_json = "1.0.95"
diff --git a/src/lib.rs b/src/lib.rs
index 8c7c051..1c59407 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -306,6 +306,9 @@ impl_config_kind!(TypeKind::String; "String"; "A socket address" => std::net::So
impl_config_kind!(TypeKind::String; "String"; "An IPv4 socket address" => std::net::SocketAddrV4);
impl_config_kind!(TypeKind::String; "String"; "An IPv6 socket address" => std::net::SocketAddrV6);
+#[cfg(feature = "url")]
+impl_config_kind!(TypeKind::String; "String"; "An URL" => url::Url);
+
#[cfg(test)]
mod tests {
use std::collections::HashMap;