Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor parsers #51

Merged
merged 14 commits into from
Sep 14, 2022
Merged

Refactor parsers #51

merged 14 commits into from
Sep 14, 2022

Conversation

elpiel
Copy link
Member

@elpiel elpiel commented Sep 10, 2022

  • Refactor of parsers to use &str instead of &[u8]
  • parse_str & parse_bytes
  • exporting modules and moving around structs and enums

Support for 2 new message types:

  • BOD (untested)
  • GBS (untested)

- add GBS to ParseResult
- handle BOD & GBS in parser::Nmea
- rename NmeaError to Error and move to module `error`
- parse_str & parse_bytes
- all_supported_messages test
- add documentation to sentences data structs
- change exports of sentences and other types
@elpiel elpiel marked this pull request as ready for review September 10, 2022 16:18
@codecov
Copy link

codecov bot commented Sep 10, 2022

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%) ⬇️
src/sentences/bod.rs 0.00% <0.00%> (ø)
src/sentences/mod.rs 0.00% <0.00%> (-61.82%) ⬇️
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%) ⬆️
src/sentences/gga.rs 95.91% <80.00%> (ø)
src/sentences/gsv.rs 96.42% <80.00%> (+1.07%) ⬆️
... 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
Copy link
Member Author

elpiel commented Sep 10, 2022

@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)

@elpiel elpiel merged commit 6e0019d into main Sep 14, 2022
@elpiel elpiel deleted the refactor-parsers branch September 14, 2022 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant