-
Notifications
You must be signed in to change notification settings - Fork 1
Usage Rust
Rylan Meilutis edited this page Jan 25, 2026
·
23 revisions
This is the primary API and the source of truth for behavior.
If this repo is used as a submodule or subtree:
# Cargo.toml
sedsprintf_rs = { path = "path/to/sedsprintf_rs" }
For a git dependency:
# Cargo.toml
sedsprintf_rs = { git = "https://github.com/Rylan-Meilutis/sedsprintf_rs.git", branch = "main" }
use sedsprintf_rs::router::{EndpointHandler, Router, RouterConfig, RouterMode};
use sedsprintf_rs::{DataEndpoint, DataType, TelemetryResult};
fn now_ms() -> u64 {
0
}
fn main() -> TelemetryResult<()> {
let handler = EndpointHandler::new_packet_handler(
DataEndpoint::SdCard,
|pkt, _link| {
println!("rx: {pkt}");
Ok(())
},
);
let cfg = RouterConfig::new([handler]);
let tx = |bytes: &[u8], _link| {
// send bytes to transport (UART/CAN/TCP/etc.)
let _ = bytes;
Ok(())
};
let router = Router::new(Some(tx), RouterMode::Sink, cfg, Box::new(now_ms));
router.log(DataType::GpsData, &[1.0_f32, 2.0, 3.0])?;
router.process_all_queues()?;
Ok(())
}
- Synchronous:
router.rx_serialized(bytes) - Queued:
router.rx_serialized_queue(bytes)and thenrouter.process_rx_queue()
If you already built a TelemetryPacket, use router.rx(&packet) or router.rx_queue(packet).
Use log_ts and log_queue_ts to provide explicit timestamps in ms.
- Use the
embeddedfeature and providetelemetryMalloc,telemetryFree, andseds_error_msgsymbols. - Compression is enabled by default; disable with
default-features = falseand avoidcompression.