Module pcd_rs::reader

source ·
Expand description

Types for reading PCD data.

Reader lets you load points sequentially with Iterator interface. The points are stored in types implementing PcdDeserialize trait. See record moduel doc to implement your own point type.

use anyhow::Result;
use pcd_rs::{PcdDeserialize, Reader};
use std::path::Path;

#[derive(PcdDeserialize)]
pub struct Point {
    x: f32,
    y: f32,
    z: f32,
    rgb: f32,
}

fn main() -> Result<()> {
    let reader = Reader::open("test_files/ascii.pcd")?;
    let points: Result<Vec<Point>> = reader.collect();
    assert_eq!(points?.len(), 213);
    Ok(())
}

Structs§

  • The Reader<T, R> struct loads points into type T from reader R.

Type Aliases§

  • The DynReader struct loads points with schema determined in runtime.