First take at removing HeaderError from YaccParser internals#554
Conversation
|
I think this one is ready now? |
|
I think it is ready, but I'd like to read through the patch more closely which I won't have time to do until tomorrow most likely. |
| // This is essentially a tuple that needs a newtype so we can implement `From` for it. | ||
| // Thus we aren't worried about it being `pub`. | ||
| #[derive(Debug, PartialEq)] | ||
| pub struct HeaderValue<T>(pub T, pub Value<T>); |
There was a problem hiding this comment.
Likely needs #[doc(hidden)], and I should just go through the docs again, to ensure there isn't anything else I added that also needs it.
There was a problem hiding this comment.
I believe all the doc changes should be fixed across various commits,
this one in 7895675
|
I did manage to get my self-review done before heading out which was mostly just documentation stuff, I suppose I'm happy with this now, the public facing API seems good at least. The callers/header building and what not seems like it could probably use some refinement, |
|
Please squash. |
6cea97d to
f32ddbb
Compare
|
Is that alright? (It leaves the Edit: I suppose it would be nice if we moved the test movement/ Edit 2x: I guess it is at least worth a try. |
This is an interim change which removes the `Header` parameter. It also adds `FromStr` implementations for generating grammars without first passing in a `YaccKind`. This patch contains a few `unwrap` calls where we currently cannot convert into the appropriate error return type. Which will be fixed in the next patch.
f32ddbb to
e5e3b65
Compare
|
I went ahead and switched moving the tests and added the That removes the |
Yep! |
This is a first take at removing the
Location/Header error from the internals ofParser,I haven't gone over the diff extremely carefully.
My original intent was to make
Headergeneric on eitherSpanorLocation, and then useHeader<Span>inside, andHeader<Location>inCTParserBuilderandnimbleparse.What I noticed though, that it was possible to do it without that change, by returning a
Result<..., HeaderError>from what is essentiallyYaccParser::newrather than fromparsewhere we currently returnYaccGrammarErrors.We absolutely could still make
Headergeneric, the parsed header results all returnLocation::Span.I thought it was worth noting this before I went ahead and did it, since the generic
Spantype permeates through both the errors, and theValuetype.