From 0059799f2f4e1237f8e20e2201a9665f10a5a976 Mon Sep 17 00:00:00 2001 From: akorchyn Date: Thu, 12 Sep 2024 14:46:42 +0300 Subject: [PATCH] bugfix: compilation --- src/types/storage.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/types/storage.rs b/src/types/storage.rs index ede4c1a..100c37a 100644 --- a/src/types/storage.rs +++ b/src/types/storage.rs @@ -1,3 +1,5 @@ +use serde::de::{Deserialize, Deserializer}; + // Taken from https://github.com/bos-cli-rs/near-socialdb-client-rs/blob/main/src/lib.rs #[derive(Debug, Clone, serde::Deserialize)] pub struct StorageBalance { @@ -6,3 +8,12 @@ pub struct StorageBalance { #[serde(deserialize_with = "parse_u128_string")] pub total: u128, } + +fn parse_u128_string<'de, D>(deserializer: D) -> Result +where + D: Deserializer<'de>, +{ + ::deserialize(deserializer)? + .parse::() + .map_err(serde::de::Error::custom) +}