[Draft] Parameterize decode and encode related structs and traits with StateTracker#47
Open
0ndorio wants to merge 4 commits intoP3KI:masterfrom
Open
Conversation
This will allow us to introduce the new StateTracker trait without any name clashes.
Includes all methods exposed by the original StateTracker struct.
Allows to use non default `StateTracker` within a `Decoder`. Also introduces strict versions of all `Decoder` related types.
|
I think the right approach is gonna be to embed a trait constant as a flag in the trait definition so the user can decide whether he wants to do strict or relaxed tracking. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now this draft only parameterizes the decoding part to ensure the given structure matches the expectations of @thequux. I am going to implement the encoding part as soon as the decoder got reviewed.
This is the second of three pull requests to introduce relaxed
StateTrackerimplementation as @thequux supposed in #44 (comment). (The changeset also still includes more changes as necessary as its based on the not yet merged pull request #46).Included Changes:
crate::decoding.StrictTrackerimplementation.Questions:
FromBencode? Right now it is limited to useStrictByteTrackerto avoid that all of the existingFromBencodeimplementations must be updated. Is this the expected behavior? Should we also introduce a generic version of this trait?Feel free to nitpick as much as possible 😁