pub fn from_struct_array(array: &StructArray) -> Result<ImuOwned, ArrowError>Expand description
Decode the first row of a StructArray into a heap-owned ImuOwned.
ยงExample
use arrow::array::StructArray;
use isaac_sim_arrow::imu::{Imu, to_record_batch, from_struct_array};
let sample = Imu {
frame_id: "imu",
lin_acc_x: 0.0, lin_acc_y: 0.0, lin_acc_z: 9.81,
ang_vel_x: 0.0, ang_vel_y: 0.0, ang_vel_z: 0.0,
orientation_w: 1.0, orientation_x: 0.0, orientation_y: 0.0, orientation_z: 0.0,
timestamp_ns: 42,
};
let batch = to_record_batch(&sample).unwrap();
let array = StructArray::from(batch);
let owned = from_struct_array(&array).unwrap();
assert_eq!(owned.frame_id, "imu");
assert_eq!(owned.timestamp_ns, 42);