I'm trying to use a trait provided by the byteorder crate:
extern crate byteorder;
use byteorder::{LittleEndian, ReadBytesExt};
fn main() {
let mut myArray = [0u8; 4];
myArray = [00000000, 01010101, 00100100, 11011011];
let result = myArray.read_u32::<LittleEndian>();
println!("{}", result);
}
I'm getting an error:
error[E0599]: no method named `read_u32` found for type `[u8; 4]` in the current scope
--> src/main.rs:10:26
|
10 | let result = myArray.read_u32::<LittleEndian>();
| ^^^^^^^^
|
= note: the method `read_u32` exists but the following trait bounds were not satisfied:
`[u8; 4] : byteorder::ReadBytesExt`
`[u8] : byteorder::ReadBytesExt`
I've read through the book chapter on traits a couple of times and can't understand why the trait bound isn't satisfied here.