-
Notifications
You must be signed in to change notification settings - Fork 268
Adds conversions from json string to generic Results #1464
Adds conversions from json string to generic Results #1464
Conversation
@@ -449,4 +501,24 @@ pub mod tests { | |||
String::from(JsonString::from(RawString::from(1))), | |||
); | |||
} | |||
|
|||
#[test] | |||
fn result_from_json_string() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@philipbeadle this should be very similar to how you want to use it in P&P
Great work! This solves exactly the problem I ran into with both HoloFuel and the App Spec tests, when trying to serialize a Result<...> response for the hdk::send/receive round-trip. Looking forward to seeing this merged! |
…l-conversions-from-json-string-to-result-option
FYI, the branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this in the feature-app-spec-query-results
branch, to return a Result<...> via hdk::send/receive
, and it worked great!
PR summary
Adds some of the missing conversion implementations for JsonString. It is now possible to
try_into
a result type directly from a JsonString.This was NOT possible before meaning bridge calls were really difficult to get right without resorting to serde_json::Value.
It needs extra implementations for all variations of result containing a
String
since this no longer implementsInto<JsonString>
changelog
Please check one of the following, relating to the CHANGELOG-UNRELEASED.md
- summary of change [PR#1234](https://github.com/holochain/holochain-rust/pull/1234)