Skip to content

Commit

Permalink
fix: correct timeout value parsing (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
JarKz authored Dec 15, 2024
1 parent 44abdb4 commit 2fe267b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/config/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,20 @@ critical = 0 # but for critical the default value will be overriden
Ok(v.into())
}

fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
if v < 0 {
Err(serde::de::Error::invalid_type(
serde::de::Unexpected::Signed(v),
&self,
))
} else {
Ok((v.clamp(0, u16::MAX as i64) as u16).into())
}
}

fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
where
A: serde::de::MapAccess<'de>,
Expand Down

0 comments on commit 2fe267b

Please sign in to comment.