-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decoders improvments #35
Conversation
@jrouaix for the It is a bit weird but there is a small comment mentioning it:
https://en.wikipedia.org/wiki/Domain_Name_System#DNS_message_format I do not think we are parsing the same data multiple times.
For above
For return string vs Result I am open to changes. The main thing i think we should be aware is IMO I think iteration should not stop even we get an error. Ex: If the library is looping/decoding through 200 entries and it fails to decode something, the library should log an error and include something (ex: partial string, original data, etc) vs return error/breaking the loop. I am open to changing what the decoders should do if it encounters an error on whether to use Result vs String, but as long as overall iteration continues and we do not skip any entries if an error is encountered. Let me know if this makes sense or helps |
HOOO ! Got it, you use I'll change that to |
@puffyCid you can have a look ? I spent some more time in the Now I also tried to avoid or delay allocation (strings re-allocations in loops), in the long run it will get us some perf improvements. I lost some precision about errors location but I find the overall design i little nicer. Tell me what you think, perhaps it's mergable now. As you wish. |
PR looks good. Thanks. Left just one minor comment. I recently merged #38 to fix an infinite loop bug. |
@puffyCid I encourage you to squash merge this PR, commits are a little messy |
merged thanks! |
Hi @puffyCid,
This time I started some work on the
decoders
module.It's a draft for now, I left a lot of todos in the
dns
file.I think there are some subtleties I don't get.
Something I have the intuition that the same data is parsed multiple times, perhaps with multiple formats, it's very weird.
Also, I have some troubles with the error handling.
Replacing
Ok
results with some default error String will bite in the end.We cannot know from the result of a function if the parsing was right.
It's probably not the right moment for a refacto on this topic, but in the end, I think we could tend to a design where
Result<_, _>
s are first class citizens as return values or even fields in the parsed structures, so the client code can choose what behavior to adopt.what do you think ?