#macro-derive #parser #px4 #ulog

macro yule_log_macros

Derive macros for the yule_log ULOG parser crate

3 releases

0.3.3 Oct 3, 2025
0.3.2 Sep 25, 2025
0.3.1 Sep 23, 2025
0.3.0 Sep 23, 2025

#5 in #px4

Download history 106/week @ 2025-09-17 242/week @ 2025-09-24 132/week @ 2025-10-01 16/week @ 2025-10-08 21/week @ 2025-10-15 5/week @ 2025-10-22

177 downloads per month
Used in yule_log

MIT license

33KB
576 lines

yule_log_macros

Derive macros for the yule_log ULOG parser.

Features

  • #[derive(ULogData)]: Maps ULOG subscriptions directly into your structs.

  • #[derive(ULogMessages)]: Aggregates your structs into a single streaming interface.

  • Forward unknown messages: Capture raw ULOG messages via #[yule_log(forward_other)].

  • Memory Efficient: Preserves the streaming nature of the yule_log parser.

Quickstart

For more information, see: yule_log.

Cargo.toml

yule_log = { version = "0.3", features = ["macros"] }

Define mappings

#[derive(ULogData)]
pub struct VehicleLocalPosition {
pub timestamp: u64,
pub x: f32,
pub y: f32,
pub z: f32,
}

Create an enum

#[derive(ULogMessages)]
pub enum LoggedMessages {
    VehicleLocalPosition(VehicleLocalPosition),
    #[yule_log(forward_other)]
    Other(yule_log::model::msg::UlogMessage),
}

Iterate over data

let stream = LoggedMessages::stream(reader)?;
for msg_res in stream {
    let msg = msg_res?;
    match msg {
        LoggedMessages::VehicleLocalPosition(v) => println!("x={} y={} z={}", v.x, v.y, v.z),
        LoggedMessages::Other(msg) => println!("Other message: {:?}", msg),
    }
}

License

This project is licensed under the MIT Licence.

Dependencies

~0.6–1MB
~22K SLoC