Add serialization deserialization
This is the general idea. I can make load generic like I did with save. With a struct that implements Serialize and Deserialize it is easy to add other implementations besides JSON. I am partial to RON, and you mentioned a curl cookie format. Let me know what you think and what I have to change to get this included, along with what tests you expect.
I didn't reuse more code than I did, because the old code was line oriented, but this Serializes and Deserializes the whole blob at once.
I am creating a pull request, but I expect some work to be done before a merge happens.
I made load generic.
Sorry about making so many commits, but this is ready for review.
Thanks for the work here; I haven't had a chance to do a proper review, so just touching this to let you know I've seen it and hope to have a chance to look it over soon.
Okay thanks. no rush.
I had some time to review this. I did a bit of a refactor; I introduced mod serde::{json,ron} and moved the relevant implementations there. I also feature gated the functionality, to avoid unnecessary dependencies. The serde_Json feature is currently enabled by default to avoid surprises, but a release will have to be a major ("0."-style, so 0.22.0) version bump anyway, so it might be better to take the opportunity and not enable it by default and avoid pulling in serde when not wanted.
I also dropped the intermediate CookieStoreSerialized struct, and just serialize/deserialize through a Vec<>, to avoid the extra level of nesting. IDK if that still suits your purpose; the only reason I'd see not to take this approach is if we anticipated adding more fields to the CookieStore that we'd want to serialize (I currently don't have any such plans).
Finally, as commented before, I don't want to fully remove the existing CookieStore::save_json and co. The new approach is IMO better, but if there are users out there (such as myself...) with "old" style cookie stores serialized, the new methods won't work with them since they are not actually valid JSON. I've introduced documentation around it to highlight the difference b/w the old methods and the new serde::Json module, as well as marking them deprecated to discourage their use.
LMK if this is still in line with the functionality you were intending.
Yeah, it's good! Thanks for your work.