jedireza / warc

:gear: A Rust library for reading and writing WARC files

Home Page:https://docs.rs/warc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

serde support?

Uinelj opened this issue · comments

Hello,

I'm using the warc library and need to serialize WARC headers, a feature that is not yet supported/implemented.

Although one can say that serde support is not in the scope of the crate (which I believe is a valid point of view), I think that it would fit the potential usage of warc.
Moreover, serde could be a feature flag, thus letting the users decide!

I've already implemented a quick way of serializing headers in my fork, and would be glad to participate in implementing the feature in the main repository if needed :)

Thanks @Uinelj. This diff seems pretty tame. I'm going to defer to @jhwgh1968

Hi @Uinelj, if you put back the ToString impl you deleted (which is used a lot), this is completely fine with me. Feel free to submit a PR.

That said, know that I am currently working on an API overhaul (slowly). I would not block you, but the next release (0.3.0) may be a while yet. You would have to base your work on current master until then.

If I'm not mistaken, the Rust docs states that ToString shouldn't be implemented directly, as implementing Display gets us the ToString implementation automagically. However if there's a reason to keep ToString only I'd be completely fine removing my change (and learning a bit more about Rust :))

Here's a minimal example from the playground.

I'll base my work on current as it is already the case.

If I'm not mistaken, the Rust docs states that ToString shouldn't be implemented directly, as implementing Display gets us the ToString implementation automagically.

I missed that. LGTM then!

Closed by #25