AeroRust / nmea

NMEA 0183 - for communication between marine electronics such as echo sounder, sonars, anemometer, gyrocompass, autopilot, GNSS receivers and many other types of instruments. Defined and controlled by the National Marine Electronics Association (NMEA)
https://crates.io/crates/nmea
Other
57 stars 41 forks source link

Refactor parsers #51

Closed elpiel closed 2 years ago

elpiel commented 2 years ago

Support for 2 new message types:

codecov[bot] commented 2 years ago

Codecov Report

Merging #51 (2d91068) into main (04aada1) will increase coverage by 2.91%. The diff coverage is 74.87%.

@@            Coverage Diff             @@
##             main      #51      +/-   ##
==========================================
+ Coverage   82.64%   85.56%   +2.91%     
==========================================
  Files          15       23       +8     
  Lines        1268     1247      -21     
==========================================
+ Hits         1048     1067      +19     
+ Misses        220      180      -40     
Impacted Files Coverage Δ
src/lib.rs 0.00% <ø> (-66.83%) :arrow_down:
src/sentences/bod.rs 0.00% <0.00%> (ø)
src/sentences/mod.rs 0.00% <0.00%> (-61.82%) :arrow_down:
src/error.rs 6.89% <6.89%> (ø)
src/sentences/gnss_type.rs 14.28% <14.28%> (ø)
src/sentences/gbs.rs 58.33% <58.33%> (ø)
src/sentences/faa_mode.rs 64.81% <64.81%> (ø)
src/parse.rs 82.35% <79.41%> (+19.11%) :arrow_up:
src/sentences/gga.rs 95.91% <80.00%> (ø)
src/sentences/gsv.rs 96.42% <80.00%> (+1.07%) :arrow_up:
... and 16 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

elpiel commented 2 years ago

@Dushistov would you like to take a look at the changes? In general, it's much cleaner and I'm planning to do the Iterator parser soon. There isn't much benefit in parsing the data as bytes because in many cases we turn it back to &str and we know that NMEA 0183 sentences should be valid ASCII anyway, so the opposite parsing makes much more sense (&[u8] -> &str) only at the beginning of the parsing (i.e. using parse_bytes)