ebarnard / rust-plist

A rusty plist parser.
MIT License
71 stars 42 forks source link

Add Data::from/to_xml_format #122

Closed cmyr closed 1 year ago

cmyr commented 1 year ago

This mirrors the similar methods on the Date type.

I'm in a funny situation where I need to construct a plist that is embedded in another XML document; I'm doing this by writing custom derive impls for the various Value types, and having these methods live here saves me from needing to manage the base64 dependency myself.

No sweat if this feels overly specific, I have other options this is just the simplest for me.

ebarnard commented 1 year ago

I don't object to these functions. I think they should line wrap when writing though - this is the function to use.

cmyr commented 1 year ago

Interesting... that function piqued my curiousity, so I went and used Xcode to write some plist files and I don't see the wrapping behaviour that is described there. Did you derive it yourself, or was there some other source?

In general the writing side of this code is sort of funny. I don't expect it to be used in the context of actually writing out a plist, for which serialize makes more sense. At best I could see it as a convenience method for writing tests; I included it for completeness.

In any case I'm now using that function, with an 'indent' value of 0.