pub fn from_struct_array(
array: &StructArray,
) -> Result<CameraDepthOwned, ArrowError>Expand description
Decode the first row of a StructArray into a heap-owned CameraDepthOwned.
ยงExample
use arrow::array::StructArray;
use isaac_sim_arrow::camera::depth::{CameraDepth, to_record_batch, from_struct_array};
let depths = vec![0.5_f32, 1.0, 1.5, 2.0];
let img = CameraDepth { depths: &depths, width: 2, height: 2,
fx: 100.0, fy: 100.0, cx: 1.0, cy: 1.0, timestamp_ns: 3 };
let batch = to_record_batch(&img).unwrap();
let array = StructArray::from(batch);
let owned = from_struct_array(&array).unwrap();
assert_eq!(owned.depths, depths);
assert_eq!(owned.timestamp_ns, 3);