I'm trying to make a function that takes T: Into<Vec<u8>>
, but when I try to pass an array of u8
to it, it doesn't compile even if From<&'a [T]>>
is implemented by Vec
:
the trait `std::convert::From<&[u8; 5]>` is not implemented for `std::vec::Vec<u8>`
Here is my code
fn is_hello<T: Into<Vec<u8>>>(s: T) {
let bytes = b"hello".to_vec();
assert_eq!(bytes, s.into());
}
fn main() {
is_hello(b"hello");
}