serde-rs/bytes

`Vec<Vec<u8>>` conversion support missing

jq-rs opened this issue · 1 comments

jq-rs commented

Hello! Thanks for this great crate! I tried to add Vec<Vec<u8>> under efficient bytes conversion but was unable to. Probably expected, would it be possible to add such support?

More detailed errors below:

...
error[E0277]: the trait bound std::vec::Vec<std::vec::Vec<u8>>: std::convert::AsRef<[u8]> is not satisfied
--> src/lib.rs:169:10
|
169 | #[derive(Serialize, Deserialize, Debug, Clone)]
| ^^^^^^^^^ the trait std::convert::AsRef<[u8]> is not implemented for std::vec::Vec<std::vec::Vec<u8>>
|
= help: the following implementations were found:
<std::vec::Vec as std::convert::AsRef<[T]>>
<std::vec::Vec as std::convert::AsRef<std::vec::Vec>>
= note: required by serde_bytes::serialize

error[E0277]: the trait bound std::vec::Vec<std::vec::Vec<u8>>: std::convert::From<std::vec::Vec<u8>> is not satisfied
--> src/lib.rs:169:21
|
169 | #[derive(Serialize, Deserialize, Debug, Clone)]
| ^^^^^^^^^^^ the trait std::convert::From<std::vec::Vec<u8>> is not implemented for std::vec::Vec<std::vec::Vec<u8>>
|
= help: the following implementations were found:
<std::vec::Vec as std::convert::From<serde_bytes::ByteBuf>>
<std::vec::Vec as std::convert::From<std::collections::BinaryHeap>>
<std::vec::Vec as std::convert::From<std::boxed::Box<[T]>>>
<std::vec::Vec as std::convert::From<&'a str>>
and 6 others
= note: required by serde_bytes::deserialize
...

jq-rs commented

I was able to workaround this with a separate struct definition. Closing.