The code would fail at assertion failure, because the error type is not a custom_err, with the assert removed, it will print:
Error:
╺━━━━━━━━━━━━━━━━━━━━┅ Backtrace ┅━━━━━━━━━━━━━━━━━━━━╸
0: Error: Error::Failed at 0x4
While parsing field 'inner' in SizedStruct
at src/main.rs:29
╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸
Which is a backtrace error, or binrw::error::Error::Backtrace(_) to be precise; while I was expecting binrw::error::Error:: Custom instead. Notice if I call read_ne on MyStruct the function could indeed return custom error, which is inconsistent, hence I feel like this is a bug in binrw.
Given below example:
The code would fail at assertion failure, because the error type is not a
custom_err
, with the assert removed, it will print:Which is a backtrace error, or
binrw::error::Error::Backtrace(_)
to be precise; while I was expectingbinrw::error::Error:: Custom
instead. Notice if I callread_ne
onMyStruct
the function could indeed return custom error, which is inconsistent, hence I feel like this is a bug in binrw.