From 9a67c86e5dfdcda03dee49f0301a37f04cb96a34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 31 Aug 2024 21:22:32 +0200 Subject: [PATCH] build(deps): update fluent-uri requirement from 0.1 to 0.2 (#31) * build(deps): update fluent-uri requirement from 0.1 to 0.2 Updates the requirements on [fluent-uri](https://github.com/yescallop/fluent-uri-rs) to permit the latest version. - [Release notes](https://github.com/yescallop/fluent-uri-rs/releases) - [Commits](https://github.com/yescallop/fluent-uri-rs/compare/v0.1.0...v0.2.0) --- updated-dependencies: - dependency-name: fluent-uri dependency-type: direct:production ... * build: adapt code to fluent_uri 0.2 * chore: allow license "MIT-0" for dependencies --------- Signed-off-by: dependabot[bot] Signed-off-by: David Bernard Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: David Bernard --- cdevents-sdk/Cargo.toml | 2 +- cdevents-sdk/src/error.rs | 2 +- cdevents-sdk/src/serde.rs | 6 +++--- cdevents-sdk/src/uri.rs | 14 +++++++------- cdevents-sdk/src/uri_reference.rs | 10 +++++----- cdevents-sdk/tests/specs.rs | 2 +- tools/cargo-deny/deny.toml | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cdevents-sdk/Cargo.toml b/cdevents-sdk/Cargo.toml index a90cacb..ff28296 100644 --- a/cdevents-sdk/Cargo.toml +++ b/cdevents-sdk/Cargo.toml @@ -11,7 +11,7 @@ description = "A Rust SDK for CDEvents" [dependencies] cloudevents-sdk = { version = "0.7", optional = true, default-features = false } -fluent-uri = "0.1" +fluent-uri = "0.2" proptest = { version = "1.4", optional = true } proptest-derive = { version = "0.5", optional = true } serde = { version = "1.0", features = ["derive"] } diff --git a/cdevents-sdk/src/error.rs b/cdevents-sdk/src/error.rs index 51ac340..acf0c47 100644 --- a/cdevents-sdk/src/error.rs +++ b/cdevents-sdk/src/error.rs @@ -7,7 +7,7 @@ pub enum Error { #[error("Empty data in cloudevent")] DataNotFoundInCloudEvent, #[error(transparent)] - UriParseError( #[from] fluent_uri::ParseError), + UriParseError( #[from] fluent_uri::error::ParseError), #[error(transparent)] SerdeJsonError( #[from] serde_json::Error), #[error("unknown error")] diff --git a/cdevents-sdk/src/serde.rs b/cdevents-sdk/src/serde.rs index e225c2f..c606c1a 100644 --- a/cdevents-sdk/src/serde.rs +++ b/cdevents-sdk/src/serde.rs @@ -29,15 +29,15 @@ pub(crate) mod datetime { pub(crate) mod fluent_uri { use serde::{de::Error, Deserialize, Deserializer, Serializer}; - pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> + pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> where D: Deserializer<'de>, { let txt = String::deserialize(deserializer)?; - fluent_uri::Uri::parse_from(txt).map_err(|e| D::Error::custom(e.1)) + fluent_uri::UriRef::parse(txt).map_err(D::Error::custom) } - pub fn serialize(input: &fluent_uri::Uri, serializer: S) -> Result + pub fn serialize(input: &fluent_uri::UriRef, serializer: S) -> Result where S: Serializer, { diff --git a/cdevents-sdk/src/uri.rs b/cdevents-sdk/src/uri.rs index d3914ea..59b670c 100644 --- a/cdevents-sdk/src/uri.rs +++ b/cdevents-sdk/src/uri.rs @@ -1,4 +1,4 @@ -// wrapper for fluent_uri::Uri to allow for restristed set of operations +// wrapper for fluent_uri::UriRef to allow for restristed set of operations // and to complete currently missing features. // Why fluent_uri? // - support uri & uri-reference, preserve the original string, but young, doesn't impl PartialEq,... @@ -14,9 +14,9 @@ use crate::UriReference; #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[cfg_attr(feature = "testkit", derive(Arbitrary))] pub struct Uri( - #[cfg_attr(feature = "testkit", proptest(value = "fluent_uri::Uri::parse_from(\"https://example.com/\".to_owned()).unwrap()"))] //TODO generate random value + #[cfg_attr(feature = "testkit", proptest(value = "fluent_uri::UriRef::parse(\"https://example.com/\".to_owned()).unwrap()"))] //TODO generate random value #[serde(with = "crate::serde::fluent_uri")] - pub(crate) fluent_uri::Uri + pub(crate) fluent_uri::UriRef ); impl PartialEq for Uri { @@ -32,7 +32,7 @@ impl FromStr for Uri { fn from_str(s: &str) -> Result { //TODO check it's not a reference URI - fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(Uri) + fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Err::from).map(Uri) } } @@ -48,7 +48,7 @@ impl TryFrom<&str> for Uri { type Error = crate::Error; fn try_from(s: &str) -> Result { - fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(Uri) + fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Error::from).map(Uri) } } @@ -56,7 +56,7 @@ impl TryFrom for Uri { type Error = crate::Error; fn try_from(s: String) -> Result { - fluent_uri::Uri::parse_from(s).map_err(|(_,e)| e.into()).map(Uri) + fluent_uri::UriRef::parse(s).map_err(Self::Error::from).map(Uri) } } @@ -72,7 +72,7 @@ impl Uri { } } -// impl From for fluent_uri::Uri { +// impl From for fluent_uri::UriRef { // fn from(uri: Uri) -> Self { // uri.0 // } diff --git a/cdevents-sdk/src/uri_reference.rs b/cdevents-sdk/src/uri_reference.rs index edd3d2a..58952ef 100644 --- a/cdevents-sdk/src/uri_reference.rs +++ b/cdevents-sdk/src/uri_reference.rs @@ -6,7 +6,7 @@ use crate::Uri; #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct UriReference( #[serde(with = "crate::serde::fluent_uri")] - pub(crate) fluent_uri::Uri + pub(crate) fluent_uri::UriRef ); impl PartialEq for UriReference { @@ -21,7 +21,7 @@ impl FromStr for UriReference { type Err = crate::Error; fn from_str(s: &str) -> Result { - fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(UriReference) + fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Err::from).map(UriReference) } } @@ -37,7 +37,7 @@ impl TryFrom<&str> for UriReference { type Error = crate::Error; fn try_from(s: &str) -> Result { - fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(UriReference) + fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Error::from).map(UriReference) } } @@ -45,7 +45,7 @@ impl TryFrom for UriReference { type Error = crate::Error; fn try_from(s: String) -> Result { - fluent_uri::Uri::parse_from(s).map_err(|(_,e)| e.into()).map(UriReference) + fluent_uri::UriRef::parse(s).map_err(Self::Error::from).map(UriReference) } } @@ -61,7 +61,7 @@ impl UriReference { } } -// impl From for fluent_uri::Uri { +// impl From for fluent_uri::UriRef { // fn from(uri: UriReference) -> Self { // uri.0 // } diff --git a/cdevents-sdk/tests/specs.rs b/cdevents-sdk/tests/specs.rs index 0cfc232..bc2c636 100644 --- a/cdevents-sdk/tests/specs.rs +++ b/cdevents-sdk/tests/specs.rs @@ -90,7 +90,7 @@ fn can_serde_example(#[files("../cdevents-specs/spec-*/examples/*.json")] #[file // "https://example.org" // rhs: // "https://example.org/" - // But it's not the case with fluent_uri::Uri + // But it's not the case with fluent_uri::UriRef // // example_txt = example_txt.replace("\"https://example.org\"", "\"https://example.org/\""); diff --git a/tools/cargo-deny/deny.toml b/tools/cargo-deny/deny.toml index 003c92a..278ac5d 100644 --- a/tools/cargo-deny/deny.toml +++ b/tools/cargo-deny/deny.toml @@ -7,7 +7,7 @@ wildcards = "deny" [licenses] confidence-threshold = 0.95 -allow = ["Apache-2.0", "MIT", "Unicode-DFS-2016"] +allow = ["Apache-2.0", "MIT", "MIT-0", "Unicode-DFS-2016"] exceptions = [] # The unpublished packages (generator) would be ignored now