Skip to content

PhyTrace Rust SDK

Crates.io docs.rs

The PhyTrace Rust SDK provides a high-performance, type-safe toolkit for integrating autonomous systems with the PhyWare data platform.

Installation

cargo add phytrace-sdk

Or add to Cargo.toml:

[dependencies]
phytrace-sdk = "0.1"
tokio = { version = "1", features = ["full"] }

Features

  • UDM Models — Strongly-typed Rust structs for all 23 UDM domains
  • Event Builder — Fluent API for constructing UDM events
  • Validation — Schema and business rule validation at the source
  • Provenance — Cryptographic signing (HMAC-SHA256) for data integrity
  • Transport — HTTP (default), with extensible transport trait
  • Reliability — File-based buffering, exponential backoff retry, batching
  • Agent — High-level orchestrator for production deployments
  • Async — Built on Tokio for high-performance async I/O

Feature Flags

Feature Default Description
http HTTP transport via reqwest
grpc gRPC transport (planned)
mqtt MQTT transport (planned)
websocket WebSocket transport (planned)
full All transport features

Quick Example

use phytrace_sdk::{UdmEvent, EventType, SourceType};
use phytrace_sdk::models::domains::{IdentityDomain, LocationDomain, Position2D};

fn main() {
    let event = UdmEvent::new(SourceType::Amr)
        .with_event_type(EventType::TelemetryPeriodic)
        .with_identity(IdentityDomain {
            source_id: Some("robot-001".to_string()),
            fleet_id: Some("warehouse-fleet".to_string()),
            ..Default::default()
        })
        .with_location(LocationDomain {
            position_2d: Some(Position2D { x: 10.5, y: 20.3 }),
            heading_rad: Some(1.57),
            ..Default::default()
        });

    let json = event.to_json_pretty().unwrap();
    println!("{}", json);
}

Contents

Requirements

  • Rust 1.75+
  • Tokio runtime