Skip to content

Commit

Permalink
Remove #[serde(deserialize_with = "treat_error_as_none")]
Browse files Browse the repository at this point in the history
This attribute makes it hard to debug certain errors and was only present on autoconnect fields.
  • Loading branch information
fuzzypixelz committed Jul 18, 2024
1 parent 7bc61d7 commit 9316ac5
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions commons/zenoh-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,6 @@ fn config_keys() {
dbg!(c.keys());
}

fn treat_error_as_none<'a, T, D>(deserializer: D) -> Result<Option<T>, D::Error>
where
T: serde::de::Deserialize<'a>,
D: serde::de::Deserializer<'a>,
{
let value: Value = serde::de::Deserialize::deserialize(deserializer)?;
Ok(T::deserialize(value).ok())
}

validated_struct::validator! {
/// The main configuration structure for Zenoh.
///
Expand Down Expand Up @@ -264,7 +255,6 @@ validated_struct::validator! {
/// The time-to-live on multicast scouting packets. (default: 1)
pub ttl: Option<u32>,
/// Which type of Zenoh instances to automatically establish sessions with upon discovery through UDP multicast.
#[serde(deserialize_with = "treat_error_as_none")]
autoconnect: Option<ModeDependentValue<WhatAmIMatcher>>,
/// Whether or not to listen for scout messages on UDP multicast and reply to them.
listen: Option<ModeDependentValue<bool>>,
Expand All @@ -281,7 +271,6 @@ validated_struct::validator! {
/// direct connectivity with each other.
multihop: Option<bool>,
/// Which type of Zenoh instances to automatically establish sessions with upon discovery through gossip.
#[serde(deserialize_with = "treat_error_as_none")]
autoconnect: Option<ModeDependentValue<WhatAmIMatcher>>,
},
},
Expand Down

0 comments on commit 9316ac5

Please sign in to comment.