From 36289197de5691b553f73da006ad02260d1da7e8 Mon Sep 17 00:00:00 2001 From: salsabiljb Date: Mon, 11 Nov 2024 02:04:35 +0100 Subject: [PATCH] fixed stable(alloc) check --- src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c0f8a9f..2b35d66 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,11 +89,12 @@ use sentence::AisSentence; use serde_json::Error as SerdeError; /// Serializes an `AisSentence` to JSON +#[cfg(any(feature = "std", feature = "alloc"))] +use lib::std::string::String; pub fn serialize_to_json(sentence: &AisSentence) -> std::result::Result { serde_json::to_string(sentence) } - -/// Deserializes an `AisSentence` from JSON +#[cfg(any(feature = "std", feature = "alloc"))] pub fn deserialize_from_json(json_data: &str) -> std::result::Result { serde_json::from_str(json_data) }