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

Replace unreachable! statements by returning Result<Self> #8

Closed
emirror-de opened this issue Sep 8, 2021 · 3 comments
Closed

Replace unreachable! statements by returning Result<Self> #8

emirror-de opened this issue Sep 8, 2021 · 3 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@emirror-de
Copy link

This somehow relates to #7, but seems different enough to me to create a new issue for this.

I am using your crate in my html5-picture. Since webp calls unreacheable! when a color profile is not supported, I am required to use panic::catch_unwind to be able to skip unsupported color profiles.

To prevent me from checking for supported color profiles and synchronize my crate every time webp changes and gets new implementations, it would be awesome that the from_XXX functions return Result<Self> instead of Self. This way it would be possible to skip unsupported profiles without catching a panic resulting in cleaner code.

jaredforth added a commit that referenced this issue Sep 8, 2021
@jaredforth
Copy link
Owner

This is a good idea. I started implementation for the Encoder struct here: 25eb155

jaredforth added a commit that referenced this issue Sep 8, 2021
add result return type for Encoder #8
@jaredforth
Copy link
Owner

This is implemented for webp = "0.2.0" version

@jaredforth jaredforth self-assigned this Sep 8, 2021
@jaredforth jaredforth added bug Something isn't working enhancement New feature or request labels Sep 8, 2021
@emirror-de
Copy link
Author

Hell, that was fast! Great work, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants