Skip to content

Commit 9a67c86

Browse files
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](yescallop/fluent-uri-rs@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] <[email protected]> Signed-off-by: David Bernard <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: David Bernard <[email protected]>
1 parent f2b4ee7 commit 9a67c86

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

cdevents-sdk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description = "A Rust SDK for CDEvents"
1111

1212
[dependencies]
1313
cloudevents-sdk = { version = "0.7", optional = true, default-features = false }
14-
fluent-uri = "0.1"
14+
fluent-uri = "0.2"
1515
proptest = { version = "1.4", optional = true }
1616
proptest-derive = { version = "0.5", optional = true }
1717
serde = { version = "1.0", features = ["derive"] }

cdevents-sdk/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub enum Error {
77
#[error("Empty data in cloudevent")]
88
DataNotFoundInCloudEvent,
99
#[error(transparent)]
10-
UriParseError( #[from] fluent_uri::ParseError),
10+
UriParseError( #[from] fluent_uri::error::ParseError<String>),
1111
#[error(transparent)]
1212
SerdeJsonError( #[from] serde_json::Error),
1313
#[error("unknown error")]

cdevents-sdk/src/serde.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ pub(crate) mod datetime {
2929
pub(crate) mod fluent_uri {
3030
use serde::{de::Error, Deserialize, Deserializer, Serializer};
3131

32-
pub fn deserialize<'de, D>(deserializer: D) -> Result<fluent_uri::Uri<String>, D::Error>
32+
pub fn deserialize<'de, D>(deserializer: D) -> Result<fluent_uri::UriRef<String>, D::Error>
3333
where
3434
D: Deserializer<'de>,
3535
{
3636
let txt = String::deserialize(deserializer)?;
37-
fluent_uri::Uri::parse_from(txt).map_err(|e| D::Error::custom(e.1))
37+
fluent_uri::UriRef::parse(txt).map_err(D::Error::custom)
3838
}
3939

40-
pub fn serialize<S>(input: &fluent_uri::Uri<String>, serializer: S) -> Result<S::Ok, S::Error>
40+
pub fn serialize<S>(input: &fluent_uri::UriRef<String>, serializer: S) -> Result<S::Ok, S::Error>
4141
where
4242
S: Serializer,
4343
{

cdevents-sdk/src/uri.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// wrapper for fluent_uri::Uri to allow for restristed set of operations
1+
// wrapper for fluent_uri::UriRef to allow for restristed set of operations
22
// and to complete currently missing features.
33
// Why fluent_uri?
44
// - support uri & uri-reference, preserve the original string, but young, doesn't impl PartialEq,...
@@ -14,9 +14,9 @@ use crate::UriReference;
1414
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1515
#[cfg_attr(feature = "testkit", derive(Arbitrary))]
1616
pub struct Uri(
17-
#[cfg_attr(feature = "testkit", proptest(value = "fluent_uri::Uri::parse_from(\"https://example.com/\".to_owned()).unwrap()"))] //TODO generate random value
17+
#[cfg_attr(feature = "testkit", proptest(value = "fluent_uri::UriRef::parse(\"https://example.com/\".to_owned()).unwrap()"))] //TODO generate random value
1818
#[serde(with = "crate::serde::fluent_uri")]
19-
pub(crate) fluent_uri::Uri<String>
19+
pub(crate) fluent_uri::UriRef<String>
2020
);
2121

2222
impl PartialEq for Uri {
@@ -32,7 +32,7 @@ impl FromStr for Uri {
3232

3333
fn from_str(s: &str) -> Result<Self, Self::Err> {
3434
//TODO check it's not a reference URI
35-
fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(Uri)
35+
fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Err::from).map(Uri)
3636
}
3737
}
3838

@@ -48,15 +48,15 @@ impl TryFrom<&str> for Uri {
4848
type Error = crate::Error;
4949

5050
fn try_from(s: &str) -> Result<Self, Self::Error> {
51-
fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(Uri)
51+
fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Error::from).map(Uri)
5252
}
5353
}
5454

5555
impl TryFrom<String> for Uri {
5656
type Error = crate::Error;
5757

5858
fn try_from(s: String) -> Result<Self, Self::Error> {
59-
fluent_uri::Uri::parse_from(s).map_err(|(_,e)| e.into()).map(Uri)
59+
fluent_uri::UriRef::parse(s).map_err(Self::Error::from).map(Uri)
6060
}
6161
}
6262

@@ -72,7 +72,7 @@ impl Uri {
7272
}
7373
}
7474

75-
// impl From<Uri> for fluent_uri::Uri<String> {
75+
// impl From<Uri> for fluent_uri::UriRef<String> {
7676
// fn from(uri: Uri) -> Self {
7777
// uri.0
7878
// }

cdevents-sdk/src/uri_reference.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::Uri;
66
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
77
pub struct UriReference(
88
#[serde(with = "crate::serde::fluent_uri")]
9-
pub(crate) fluent_uri::Uri<String>
9+
pub(crate) fluent_uri::UriRef<String>
1010
);
1111

1212
impl PartialEq for UriReference {
@@ -21,7 +21,7 @@ impl FromStr for UriReference {
2121
type Err = crate::Error;
2222

2323
fn from_str(s: &str) -> Result<Self, Self::Err> {
24-
fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(UriReference)
24+
fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Err::from).map(UriReference)
2525
}
2626
}
2727

@@ -37,15 +37,15 @@ impl TryFrom<&str> for UriReference {
3737
type Error = crate::Error;
3838

3939
fn try_from(s: &str) -> Result<Self, Self::Error> {
40-
fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(UriReference)
40+
fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Error::from).map(UriReference)
4141
}
4242
}
4343

4444
impl TryFrom<String> for UriReference {
4545
type Error = crate::Error;
4646

4747
fn try_from(s: String) -> Result<Self, Self::Error> {
48-
fluent_uri::Uri::parse_from(s).map_err(|(_,e)| e.into()).map(UriReference)
48+
fluent_uri::UriRef::parse(s).map_err(Self::Error::from).map(UriReference)
4949
}
5050
}
5151

@@ -61,7 +61,7 @@ impl UriReference {
6161
}
6262
}
6363

64-
// impl From<UriReference> for fluent_uri::Uri<String> {
64+
// impl From<UriReference> for fluent_uri::UriRef<String> {
6565
// fn from(uri: UriReference) -> Self {
6666
// uri.0
6767
// }

cdevents-sdk/tests/specs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn can_serde_example(#[files("../cdevents-specs/spec-*/examples/*.json")] #[file
9090
// "https://example.org"
9191
// rhs:
9292
// "https://example.org/"
93-
// But it's not the case with fluent_uri::Uri
93+
// But it's not the case with fluent_uri::UriRef
9494
//
9595
// example_txt = example_txt.replace("\"https://example.org\"", "\"https://example.org/\"");
9696

tools/cargo-deny/deny.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ wildcards = "deny"
77

88
[licenses]
99
confidence-threshold = 0.95
10-
allow = ["Apache-2.0", "MIT", "Unicode-DFS-2016"]
10+
allow = ["Apache-2.0", "MIT", "MIT-0", "Unicode-DFS-2016"]
1111
exceptions = []
1212

1313
# The unpublished packages (generator) would be ignored now

0 commit comments

Comments
 (0)