Currently there is only one error when something goes wrong (The empty struct BitsError). So it is quite difficult to find out what exactly is causing the error.
Please at least add some indication which struct/enum is causing the error.
For example in the following code the error should point out that Bar has no variant that matches 0b0001:
fn error_test(){
#[bitsize(4)]
#[derive(TryFromBits)]
enum Foo {
One = 0b0001,
Two = 0b0010,
};
#[bitsize(4)]
#[derive(TryFromBits)]
enum Bar {
Three = 0b0011,
Four = 0b0100,
};
#[bitsize(8)]
#[derive(TryFromBits)]
struct Byte {
foo: Foo,
bar: Bar,
}
let b = Byte::try_from(0b0001_0001).unwrap();
}
Currently there is only one error when something goes wrong (The empty struct
BitsError
). So it is quite difficult to find out what exactly is causing the error. Please at least add some indication which struct/enum is causing the error. For example in the following code the error should point out thatBar
has no variant that matches0b0001
: