seanmonstar / httparse

A push parser for the HTTP 1.x protocol in Rust.
https://docs.rs/httparse
Apache License 2.0
569 stars 110 forks source link

README is outdated #90

Closed PawelLawrynowicz closed 2 years ago

PawelLawrynowicz commented 3 years ago

In the "Usage" part of the README file:

assert!(req.parse(buf)?.is_partial());

throws an error:

cannot use the ? operator in a function that returns ()

The correct usage is as in the documentation:

req.parse(buf).unwrap().is_partial()
songww commented 2 years ago

Your test func should return httparse::Result<()> to use ? for early return.