Skip to content

Commit 625592f

Browse files
Merge #461
461: Replace `iso8601-duration` with `iso8601` crate r=bidoubiwa a=LukasKalbertodt # Pull Request ## Related issue Fixes #<issue_number> ## What does this PR do? Replace `iso8601-duration` with `iso8601` crate. For one, this updates the indirect dependency `nom` from 5.x to 7.x, which gets rid of a future incompatibility warning produced by the compiler: warning: the following packages contain code that will be rejected by a future version of Rust: nom v5.1.2 note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 67` But to achieve that I could have updated `iso8601-duration` to 0.2. However, the 0.2 version makes conversion into an `std::time::Duration` weirdly hard. And I'm also confused by the fields being `f32` for no reason I can think of. Additionally, the crate has very few users and there is no changelog. So in general, the `iso8601` crate looks much better. Even if it gives us date parsing, which we don't need, I think it's still a better option. ## PR checklist Please check if your PR fulfills the following requirements: - [ ] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [ ] Have you read the contributing guidelines? - [ ] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Lukas Kalbertodt <[email protected]>
2 parents 30dc730 + 0f7e2cd commit 625592f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ members = ["examples/*"]
1313

1414
[dependencies]
1515
async-trait = "0.1.51"
16-
iso8601-duration = "0.1.0"
16+
iso8601 = "0.6.1"
1717
log = "0.4"
1818
serde = { version = "1.0", features = ["derive"] }
1919
serde_json = "1.0"

src/tasks.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ where
137137
D: Deserializer<'de>,
138138
{
139139
let s = String::deserialize(deserializer)?;
140-
let iso_duration = iso8601_duration::Duration::parse(&s).map_err(serde::de::Error::custom)?;
141-
Ok(iso_duration.to_std())
140+
let iso_duration = iso8601::duration(&s).map_err(serde::de::Error::custom)?;
141+
Ok(iso_duration.into())
142142
}
143143

144144
#[derive(Deserialize, Debug, Clone)]
@@ -811,7 +811,7 @@ mod test {
811811
..
812812
}
813813
}
814-
if duration == Duration::from_secs_f32(10.848957061)
814+
if duration == Duration::from_millis(10_848)
815815
));
816816
}
817817

0 commit comments

Comments
 (0)