davidhewitt/pythonize

De/serialize Vec<u8> as bytes()

gaetanww opened this issue · 1 comments

Is it possible to serialize and deserialize rust's Vec<u8> as python bytes()?

Thanks for the question, and sorry I took a few days to reply.

I don't think it's possible for Vec<u8> to serialize as bytes type, because the exact code path for Vec<u8> is defined by serde, which serializes Vec<u8> as a sequence of numbers.

I suggest you instead use the bytes::Bytes type, which does serialize to Python bytes.