You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactoring UnrarError seems necessary as there's a need for errors on the Rust side of things, and abusing the FFI error codes for that is quite problematic. There seems to be room for some other improvements as well.
Some ideas for changes:
Move some of the error::Code logic to types within unrar_sys, for example RARReadHeader could return something like enum ReadResult {..} with the relevant Codes.
The type parameter for the data type in UnrarError makes it kind of unwieldy, and should be removed.
Additionally it could be nice to have the error type(s) implement std::error::Error, either manually or by using something like thiserror. There's a nice survey on the current state of error handling in Rust, in case you're interested in using a library for this.
The text was updated successfully, but these errors were encountered:
Refactoring
UnrarError
seems necessary as there's a need for errors on the Rust side of things, and abusing the FFI error codes for that is quite problematic. There seems to be room for some other improvements as well.Some ideas for changes:
error::Code
logic to types withinunrar_sys
, for exampleRARReadHeader
could return something likeenum ReadResult {..}
with the relevantCode
s.data
type inUnrarError
makes it kind of unwieldy, and should be removed.Additionally it could be nice to have the error type(s) implement
std::error::Error
, either manually or by using something like thiserror. There's a nice survey on the current state of error handling in Rust, in case you're interested in using a library for this.The text was updated successfully, but these errors were encountered: