-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Product Data] Config deserialization bug fix (#5126)
* fix no address deserialization bug * bug fix in stats_id generation * better stats id generation * andrew's nitpicking
- Loading branch information
1 parent
43e4224
commit b8c1014
Showing
7 changed files
with
40 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright 2023 - Nym Technologies SA <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use serde::{Deserialize, Deserializer}; | ||
use serde::{Deserialize, Deserializer, Serializer}; | ||
use std::fmt::Display; | ||
use std::path::PathBuf; | ||
use std::str::FromStr; | ||
|
@@ -20,6 +20,17 @@ where | |
} | ||
} | ||
|
||
pub fn ser_maybe_stringified<S, T>(field: &Option<T>, serializer: S) -> Result<S::Ok, S::Error> | ||
where | ||
S: Serializer, | ||
T: Display, | ||
{ | ||
match field { | ||
Some(inner) => serializer.serialize_str(&inner.to_string()), | ||
None => serializer.serialize_str(""), | ||
} | ||
} | ||
|
||
pub fn de_maybe_string<'de, D>(deserializer: D) -> Result<Option<String>, D::Error> | ||
where | ||
D: Deserializer<'de>, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters