Skip to main content

encode_frame

Function encode_frame 

Source
pub fn encode_frame(msg: &StreamMessage) -> Result<Vec<u8>>
Expand description

Encode a streaming frame.

to_vec_named, not to_vec. msgpack can write a struct either as a map of named fields or as a bare array of values, and rmp_serde::to_vec chooses the array. Value is an adjacently-tagged enum, which can only be read back from named fields — so every frame carrying a tensor encoded fine and then failed to decode with “invalid type: sequence, expected struct variant Value::Tensor”.

Nobody saw it because both receivers dropped the error: one behind if let Ok(..), the other behind unwrap_or_default(), which sent an empty frame. The chunk simply never arrived.