rmonitor

Crates.iormonitor
lib.rsrmonitor
version0.3.0
sourcesrc
created_at2020-05-09 12:45:05.310322
updated_at2024-02-03 11:03:48.365204
descriptionA simple, Tokio-compatible protocol decoder for RMonitor, a line based timing protocol supported by different vendors of sport timing software.
homepagehttps://github.com/bradfier/rmonitor
repository
max_upload_size
id239244
size3,848,152
Richard Bradfield (bradfier)

documentation

https://docs.rs/rmonitor

README

RMonitor for Rust

GHA Build Status MIT/Apache Licensed crates.io Docs

A simple, Tokio-compatible protocol decoder for RMonitor, a line based timing protocol supported by different vendors of sport timing software.

The decoder supports both:

Example

You'll need rmonitor, tokio and tokio-util in your dependencies:

rmonitor = "0.2"
tokio-util = { version = "0.3", features = ["codec"] }
tokio = { version = "0.2", features = ["full"] }

Then create your main.rs:

use rmonitor::RMonitorDecoder;
use std::error::Error;
use tokio::net::TcpStream;
use tokio::stream::StreamExt;
use tokio_util::codec::FramedRead;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    // Connect to your target RMonitor server
    let stream = TcpStream::connect("127.0.0.1:4000").await?;

    // Construct a decode with a maximum line length of 2048
    let mut reader = FramedRead::new(stream, RMonitorDecoder::new_with_max_length(2048));

    while let Ok(Some(Ok(event))) = reader.next().await {
        println!("{:?}", event);
    }

    Ok(())
}

A synchronous example is also available to show use of the decoder without pulling in a Tokio runtime.

License

Licensed under either of

at your option.

Commit count: 0

cargo fmt