[][src]Module pcd_rs::record

The module defines PCDRecordRead and PCDRecordWrite traits. Both are analogous to points in PCD data.

Any object scanned by readers or written by writers must implement PCDRecordRead or PCDRecordWrite respectively.

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

use pcd_rs::{PCDRecordRead, PCDRecordWrite};

#[derive(PCDRecordRead, PCDRecordWrite)]
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.

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

PCDRecordWrite 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::{PCDRecordRead};

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

The module provides Field, an enum of data fields, and Record, an alias of Vec<Field> for untyped data loading. Record already implements PCDRecordRead, and can be directly passed to reader.

Structs

TypedSchema

Indicates the record schema is known in compile-time.

UntypedRecord

Represents an untyped point in PCD data.

UntypedSchema

Indicates the record schema is only-known in run-time.

Enums

Field

An enum representation of untyped data fields.

Traits

PCDRecordRead

PCDRecordRead is analogous to a point returned from a reader.

PCDRecordWrite

PCDRecordWrite is analogous to a point written by a writer.

SchemaKind

Represents if a record type is typed or not.