Review httpdate before the release of v1.0

Hi, I've written httpdate a small crate to parse and write HTTP header fields containing dates. It is widely used in the Rust ecosystem including by hyper, sentry and gotham.

Since the crate has been very stable over the past years I want to finally release v1.0. :partying_face:

Please have a look at the v1.0.0-alpha release and the repository. I appreciate any feedback.


The public API looks good, although I would recommend removing the impl From<ParseIntError> for Error implementation, since it doesn't really make sense to support that.

In the code itself, you can better express format!("{}", HttpDate::from(d)) with HttpData::from(d).to_string() - it runs the same code internally but looks nicer.


This implementation is used in the parser when parsing an integer fails and converts the ParseIntError to an error from the HTTP date. Otherwise I have to write hour = s.parse().map_err(|_| Error(()))? everywhere. Or is there a nicer way?

You can have an internal functiom that outputs a Result<T, ParseIntError> and then only map_err on the outer one:

(|| {
    /* ... */
.map_err(|_| Error(()))

Or you can add a private function:

fn cvt_err(_: ParseIntError) -> Error {

So writing .map_err(cvt_err)? is shorter.

Thank you for your help!

I released v1.0 just now.