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
error[E0277]: the trait bound `packed_struct::types::Integer<u16, packed_struct::types::bits::Bits2>: std::convert::From<u16>` is not satisfied
--> src\main.rs:8:32
|
8 | #[derive(Debug, PartialEq, Eq, PackedStruct)]
| ^^^^^^^^^^^^ the trait `std::convert::From<u16>` is not implemented for `packed_struct::types::Integer<u16, packed_struct::types::bits::Bits2>`
|
= help: the following implementations were found:
<packed_struct::types::Integer<i16, packed_struct::types::bits::Bits10> as std::convert::From<i16>>
<packed_struct::types::Integer<i16, packed_struct::types::bits::Bits11> as std::convert::From<i16>>
<packed_struct::types::Integer<i16, packed_struct::types::bits::Bits12> as std::convert::From<i16>>
<packed_struct::types::Integer<i16, packed_struct::types::bits::Bits13> as std::convert::From<i16>>
and 124 others
= note: required because of the requirements on the impl of `std::convert::Into<packed_struct::types::Integer<u16, packed_struct::types::bits::Bits2>>` for `u16`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
I was looking at the other issues but I could not find any helpfull information.
The text was updated successfully, but these errors were encountered:
u16 cannot be packed and unpacked from 2 bits, you need to wrap it with a type that fits into there. Following the example from the main README file, use this as the type for your fields:
Hello I am trying to translate my C code into rust. I am using your crate to get bitfields support. When I do sth like this:
I am getting errors like this:
I was looking at the other issues but I could not find any helpfull information.
The text was updated successfully, but these errors were encountered: