Skip to main content

format

Function format 

Source
pub fn format(frame: &CanFrame) -> String
Expand description

Format a frame as a GridConnect string (without a trailing newline).

The identifier is always written as eight uppercase hex digits and the frame type as N. Append '\n' when writing to a serial port or TCP socket; most peers (JMRI included) expect line-separated frames.

use rolcb::{gridconnect, CanFrame};

let f = CanFrame::new(0x1070_0285, &[])?;
assert_eq!(gridconnect::format(&f), ":X10700285N;");