Skip to content
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

StreamingDecoder: DEC: BorrowMut<FrameDecoder> isn't very useful #74

Open
nodakai opened this issue Nov 11, 2024 · 1 comment
Open

StreamingDecoder: DEC: BorrowMut<FrameDecoder> isn't very useful #74

nodakai opened this issue Nov 11, 2024 · 1 comment

Comments

@nodakai
Copy link

nodakai commented Nov 11, 2024

Currently, DEC must return a concrete instance of FrameDecoder for performing the actual decoding process. I couldn't customize its behavior to include functionality such as tracking the number of decoded bytes.

It would be helpful if FrameDecoder implemented a trait that wraps its .read() method. This way, DEC could be bound to that trait, allowing for more flexible and customizable behavior during decoding.

@KillingSpark
Copy link
Owner

I'm not sure what you are tying to accomplish here. To count the decoded bytes you can customize the source which is already generic over the Read trait. The reason StreamingDecoder takes a generic parameter for the decoder at all is that this allows both an owned version as well as a borrowed version without having separate types for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants