-
-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a hint about deserializing helper params #205
base: master
Are you sure you want to change the base?
Conversation
Sadly I had to add |
src/lib.rs
Outdated
//! Ok(()) | ||
//! } | ||
//! | ||
//! fn main() {} |
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.
you can add #
to hide this line in doc generation
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.
Thanks! didn't know. I will hide main
and the obvious extern crate ...
hi @flxo , this looks like a good and convenient way for accessing json value, with type-safe guarantee. But it has a |
@sunng87 I stumbled across the I'm using this pattern in a code generator where the extra deserialisation doesn't hurt nor the |
This addition adds a note about the easy possiblity to work with helper parameters in their original type representation by using `Deserialize`.
By the way, how about adding a helper function to |
Sounds great, but I think calling pub fn try_into(self) -> Result<T, RenderError> { wouldn't work because it can never be called on a With the pub fn try_into<T: ::serde::de::DeserializeOwned>(&self) -> Result<T, RenderError> {
::serde_json::from_value(self.value.clone())
.map_err(|e| e.into())
} |
This addition adds a note about the easy possiblity to work with helper
parameters in their original type representation by using
Deserialize
.