-
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
Consider adding anyhow
as a dependency
#24
Comments
Hey @odilf!
I suppose I would not call it a "hard rule", maybe just a personal aesthetic preference for minimalism. The points you make in favor of
If you have a good idea of what this refactor would look like, then go for it — and I will help review & test. Ideally it would be backwards compatible, but it's not the end of the world if that isn't possible. Hopefully the introduction of (And if anyone stumbling across this issue disagrees with that, make it known!) |
thiserror is typically used for lib crates. However sidecar seems to be somewhere in the middle. From thiserror docs:
|
That sounds great!
So... I don't think there is a way to make it strictly backwards compatible. The Maybe we want to keep the error module tho? I.e., make it re-export the anyhow Error so people using that module have less things to change. I'd rather remove it too since it's a breaking change anyway, but I don't have strong feelings about it. |
Well, I would say thiserror is better when you can have structure to your errors and you're able to enumerate all the failure modes. Here we forward various ffmpeg errors which are unstructured so might as well just use anyhow, imo. Also, using anyhow is a small change because as @nathanbabcock said the current Oh and lastly I believe a lot (if not most) downstream consumers would/are using anyhow regardless, so it's kinda the same either way. |
I have been using this crate for a project and it is fantastic! However, there is one problem: it doesn't play nicely with
anyhow
. This is mainly because the error doesn't implementSend
andSync
. While looking through the code I realized that there is an error module that does things very similarly to anyhow. In fact, it would be very easy to change all errors and results to the anyhow equivalents. That would also bring along all other benefits of anyhow such as the size of struct being only ausize
, better ergonomics, etc.I understand that this project has a "no dependency" rule. I don't know if that's a hard rule for you, but I would consider changing it. Currently it seems that the
error
module is just a worse version of anyhow, so why not add actual anyhow as a dependency? The only concrete reason I can think of for not using it as a dependency is because of compile time concerns, but it's usually faster because crates can be compiled in parallel and compilations shared between subdependencies. Rust has little of the disadvantages that some other languages have with deps. Re-inventing the wheel in this way is very rarely a good idea.I understand that sometimes open source contributors get a lot of often unreasonable demands, so I want to reiterate that I really appreciate your work! This is just a thing I think is good to consider to make the crate even better 😁
I would be more than glad to do the migration to
anyhow
myself if I get the approval.The text was updated successfully, but these errors were encountered: