Skip to content

Commit

Permalink
Fix Config::from_deserializer
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz committed Sep 17, 2024
1 parent 1933f8f commit 30df65b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion zenoh/src/api/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,22 @@ impl Config {
self.0.remove(key)
}

// REVIEW(fuzzypixelz): the error variant of the Result is a Result because this does
// deserialization AND validation.
#[zenoh_macros::unstable]
pub fn from_deserializer<'d, D: serde::Deserializer<'d>>(
d: D,
) -> Result<Self, Result<Self, D::Error>>
where
Self: serde::Deserialize<'d>,
{
Ok(Config(zenoh_config::Config::from_deserializer(d)?))
match zenoh_config::Config::from_deserializer(d) {
Ok(config) => Ok(Config(config)),
Err(result) => match result {
Ok(config) => Err(Ok(Config(config))),
Err(err) => Err(Err(err)),
},
}
}
}

Expand Down

0 comments on commit 30df65b

Please sign in to comment.