我有<代码>Vec<Bytes>,希望将其用作<代码>Any:decode(。
由于<代码>Any:decode() s case is a Buf
trait that does not need a contiguous memory, theoryly, Vec<Bytes>
can be used withoutplicaing memory.
然而,由于<代码>Vec<Bytes>没有实施Buf
trait,需要将其转化为不同的东西。
While this scenario seems somewhat common, I failed to find an existing solution.
我如何能够做到这一点?
- For
Bytes
andBuf
, see https://docs.rs/bytes/1.5.0/bytes/ - For
Any
, see https://docs.rs/prost-types/latest/prost_types/struct.Any.html
(However, familiarity withAny
is not necessary. all I want to know is how to useVec<Bytes>
as aBuf
.)