pub fn from_struct_array(array: &StructArray) -> Result<CmdVel, ArrowError>Expand description
Decode a single CmdVel sample from a StructArray whose fields
match schema. Returns the first row; errors on field mismatch
or empty input. Symmetric to to_record_batch.
ยงExample
use arrow::array::StructArray;
use isaac_sim_arrow::cmd_vel::{CmdVel, to_record_batch, from_struct_array};
let twist = CmdVel { linear_x: 1.0, angular_z: -0.5, ..CmdVel::default() };
let batch = to_record_batch(&twist).unwrap();
let array = StructArray::from(batch);
let decoded = from_struct_array(&array).unwrap();
assert_eq!(decoded, twist);