[][src]Module pcd_rs::record

Defines serializing and deserializing traits and common record types.

Any object scanned by readers or written by writers must implement PcdDeserialize or PcdSerialize respectively.

These traits are not intended to implemented manually. Please use derive macro instead. For example,

use pcd_rs::{PcdDeserialize, PcdSerialize};

#[derive(PcdDeserialize, PcdSerialize)]
pub struct TimestampedPoint {
    x: f32,
    y: f32,
    z: f32,
    timestamp: u32,
}

The derive macro accepts normal structs and tuple structs, but does not accept unit structs.

PcdDeserialize allows fields with either primitive type, array of primitive type or Vec of primitive type.

PcdSerialize allows fields with either primitive type or array of primitive type. The Vec is ruled out since the length is not determined in compile-time.

Make sure struct field names match the FIELDS header in PCD data. Otherwise it panics at runtime. You can specify the exact name in header or bypass name check with attributes. The name check are automatically disabled for tuple structs.

use pcd_rs::PcdDeserialize;

#[derive(PcdDeserialize)]
pub struct TimestampedPoint {
    x: f32,
    y: f32,
    z: f32,
    #[pcd_rename("true_name")]
    rust_name: u32,
    #[pcd_ignore_name]
    whatever_name: u32,
}

Structs

DynRecord

Represents an untyped point in PCD data.

Enums

Field

An enum representation of untyped data fields.

Traits

PcdDeserialize

PcdDeserialize is analogous to a point returned from a reader.

PcdSerialize

PcdSerialize is analogous to a point written by a writer.