Skip to content

Commit

Permalink
Assert iterator field is last field.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Sep 10, 2022
1 parent 3c1d10d commit a52005a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ublox_derive/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ pub fn generate_send_code_for_packet(pack_descr: &PackDesc) -> TokenStream {
let mut write_fields = Vec::with_capacity(pack_descr.fields.len());
let mut extend_fields = Vec::with_capacity(pack_descr.fields.len());
let mut off = 6usize;
for f in &pack_descr.fields {
for (fi, f) in pack_descr.fields.iter().enumerate() {
let ty = f.intermediate_type();
let name = f.intermediate_field_name();
let field_comment = &f.comment;
Expand All @@ -246,7 +246,9 @@ pub fn generate_send_code_for_packet(pack_descr: &PackDesc) -> TokenStream {
});

builder_needs_lifetime = true;
continue;

assert_eq!(fi, pack_descr.fields.len() - 1, "Iterator field must be the last field.");
break;
}
};

Expand Down

0 comments on commit a52005a

Please sign in to comment.