'Serialize a vector of serializable/serialized elements
If we have a vector of serializable elements, how to serialize the vector?
In particular, how to process if each serialized element is a byte array (e.g [u8; 56])?
let mut byte_stream = data
.iter()
.map(|x| x.to_bytes())
.collect::<Vec<_>>()
This snippet produces a variable of type Vec<[u8; 56]>.
To transmit data, I plan to use std::io::write but it requires a byte slice &[u8].
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
