zaari / nmea-parser

Rust NMEA 0183 sentence parser for AIS and GNSS messages.
Apache License 2.0
40 stars 25 forks source link

Cannot access underlying data #10

Closed tiphaineruy closed 3 years ago

tiphaineruy commented 3 years ago

Issue: When parsing an AIS frame. you sometime might want to access the raw data.

example: VesselDynamicData.nav_status is an enum constructed from an u8 field. If you need to use the parser as an intermediate parser for other tool, you might want to use the underlying u8 and not manipulate the enum

solutions:

tiphaineruy commented 3 years ago

Simplest would be

/// Navigation status for VesselDynamicData

[derive(Clone, Copy, Debug, PartialEq)]

pub enum NavigationStatus { UnderWayUsingEngine = 0, // 0 AtAnchor = 1, // 1 NotUnderCommand = 2, // 2 .... }

allowing let nav_status = NavigationStatus::UnderWayUsingEngine as u8