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

Make Decoder/Encoded non-generic #245

Open
RazrFalcon opened this issue Sep 12, 2020 · 2 comments
Open

Make Decoder/Encoded non-generic #245

RazrFalcon opened this issue Sep 12, 2020 · 2 comments
Projects

Comments

@RazrFalcon
Copy link
Contributor

Right now, if I want to decode/encode a PNG from a slice and from a file, I have to instance the whole png crate twice. Which blow ups the binary size.

It would be better and less error-prone to have a non-generic implementation. The public API can still be generic, in theory. But the actual decoding/encoding code should be instanced only once.

@HeroicKatora
Copy link
Member

Have you tried using dyn BufRead instead? The performance difference should be negligible, the reason why png can't use it is more or less due to auto-trait (Send + Sync) and lifetime accuracy.

@RazrFalcon
Copy link
Contributor Author

Right now, I'm simply reading the file into memory and then decode it as slice.

@HeroicKatora HeroicKatora added this to To Do in 0.17 Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
0.17
Ideas
Development

No branches or pull requests

2 participants