Function flarmnet::xcsoar::encode_file

source ·
pub fn encode_file(file: &File) -> Result<Vec<u8>, EncodeError>
Expand description

Encodes a FlarmNet file.

Examples

let file = flarmnet::File {
    version: 123,
    records: vec![
        Record {
            flarm_id: "3EE3C7".to_string(),
            pilot_name: "Tobias Bieniek".to_string(),
            airfield: "EDKA".to_string(),
            plane_type: "LS6a".to_string(),
            registration: "D-0816".to_string(),
            call_sign: "SG".to_string(),
            frequency: "130.530".to_string(),
        }
    ]
};

let result = flarmnet::xcsoar::encode_file(&file).unwrap();
assert_eq!(result, br#"00007b
334545334337546f62696173204269656e69656b2020202020202045444b4120202020202020202020202020202020204c5336612020202020202020202020202020202020442d30383136205347203133302e353330
"#);