-
There is a way to deserialize a 3rd party container like that: #[binread]
struct S {
#[br(temp)]
len: u8,
#[br(parse_with = binrw::helpers::count(len as usize))]
container: arrayvec::ArrayVec<u8, 255>,
} But how to serialize this container? Is it possible only with custom |
Beta Was this translation helpful? Give feedback.
Answered by
csnover
Nov 27, 2024
Replies: 1 comment 3 replies
-
Hi, and thanks for your question! If the third-party container can be converted to a slice, then it can be written by e.g. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
magras
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, and thanks for your question! If the third-party container can be converted to a slice, then it can be written by e.g.
#[bw(map = |c| &c[..])]
, which will then use binrw’s built-in write implementation for slices.