samscott89 / serde_qs

Serde support for querystring-style strings
Apache License 2.0
193 stars 68 forks source link

Expose Deserializer #97

Closed paul-hansen closed 7 months ago

paul-hansen commented 7 months ago

Similar to exposing the Serializer in https://github.com/samscott89/serde_qs/issues/63 would it be possible to expose the Deserializer?

I'm using serde_urlencoded with serde_path_to_error and would like to switch to serde_qs but I don't see how to do this with the current public API (lmk if I might be missing something). Here's the code I used with serde_urlencoded:

// bytes comes from my axum extractor
let parser = form_urlencoded::parse(&bytes);
let deserializer = serde_urlencoded::Deserializer::new(parser);
let value: T = serde_path_to_error::deserialize(deserializer).map_err(
  // map to my custom FormErrors object that supports displaying the errors on the related form field
);

Thanks for this library! I've been using it indirectly through Leptos and have been moving away from their server functions to get error handling setup way I want it.

paul-hansen commented 7 months ago

Looks like there is an open PR for this already: https://github.com/samscott89/serde_qs/pull/91 While it's odd that creating the deserializer can error, I can work with that.

I see that PR has been sitting for awhile, If you'd like other changes to it lmk and I'd be happy to adopt it if the author isn't around.

paul-hansen commented 7 months ago

91 was merged. Thanks!