pub fn from_struct_array(
array: &StructArray,
) -> Result<LidarPointCloudOwned, ArrowError>Expand description
Decode the first row of a StructArray into a heap-owned LidarPointCloudOwned.
ยงExample
use arrow::array::StructArray;
use isaac_sim_arrow::lidar::pointcloud::{LidarPointCloud, to_record_batch, from_struct_array};
let points = [1.0_f32, 0.0, 0.0];
let pc = LidarPointCloud { points: &points, num_points: 1, width: 1, height: 1 };
let batch = to_record_batch(&pc).unwrap();
let array = StructArray::from(batch);
let owned = from_struct_array(&array).unwrap();
assert_eq!(owned.num_points, 1);
assert_eq!(&owned.points, &[1.0_f32, 0.0, 0.0]);