[−][src]Function srec::writer::generate_srec_file
pub fn generate_srec_file(records: &[Record]) -> String
Converts each provided record to a string, joining them with newlines ('\n') to generate an LF terminated SREC file
Does not perform any validation on the provided records. The caller is responsible for ensuring records do not contain duplicate/overlapping data and that records are in the correct order.
Examples
let s = srec::writer::generate_srec_file(&[ srec::Record::S0("HDR".into()), srec::Record::S1(srec::Data { address: srec::Address16(0x1234), data: vec![0x00, 0x01, 0x02, 0x03], }), srec::Record::S1(srec::Data { address: srec::Address16(0x1238), data: vec![0x04, 0x05, 0x06, 0x07], }), srec::Record::S9(srec::Address16(0x1234)), ]); assert_eq!( s, "S00600004844521B\nS107123400010203AC\nS10712380405060798\nS9031234B6\n" );