Skip to content

Commit

Permalink
feat(parse-duration): use better crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Ushie committed May 12, 2023
1 parent a194e03 commit 8f10edd
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 11 deletions.
77 changes: 70 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ tracing = { version = "0.1.37", features = ["max_level_debug", "release_max_leve
tracing-subscriber = "0.3.16"
hmac-sha256 = "1.1.6"
base64 = "0.21.0"
go-parse-duration = "0.1.1"
parse_duration = "2.1.1"
6 changes: 3 additions & 3 deletions src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub mod media_channel;
pub mod moderation;
pub mod poll;

pub fn parse_duration(duration: String) -> Result<Duration, go_parse_duration::Error> {
let d = go_parse_duration::parse_duration(&duration)?;
Ok(Duration::nanoseconds(d))
pub fn parse_duration(duration: String) -> Result<Duration, parse_duration::parse::Error> {
let d = parse_duration::parse(&duration)?;
Ok(Duration::nanoseconds(d.as_nanos() as i64))
}

0 comments on commit 8f10edd

Please sign in to comment.