pub fn from_struct_array(
array: &StructArray,
) -> Result<CameraRgbOwned, ArrowError>Expand description
Decode the first row of a StructArray into a heap-owned CameraRgbOwned.
ยงExample
use arrow::array::StructArray;
use isaac_sim_arrow::camera::rgb::{CameraRgb, to_record_batch, from_struct_array};
let pixels = vec![255u8; 12]; // 2x2 RGB white
let img = CameraRgb { pixels: &pixels, width: 2, height: 2,
fx: 100.0, fy: 100.0, cx: 1.0, cy: 1.0, timestamp_ns: 5 };
let batch = to_record_batch(&img).unwrap();
let array = StructArray::from(batch);
let owned = from_struct_array(&array).unwrap();
assert_eq!(owned.pixels.len(), 12);
assert_eq!(owned.timestamp_ns, 5);