noritada / grib-rs

GRIB format parser for Rust
Apache License 2.0
57 stars 9 forks source link

Introduce SubMessage::decode() and remove Grib2::get_values() #24

Closed noritada closed 2 years ago

noritada commented 2 years ago

This PR introduces SubMessage::decode() and removes Grib2::get_values().

Background of this change

Until now, it was necessary to use Grib2::get_values() to call a decoding function on data. However, it does not work well with other APIs, especially the submessage iterators that are being enhanced recently.

Submessage iterators make it easy to discover and filter submessages. However, decoding found submessages is inefficient because users need to pass the indices of the found submessages to Grib2::get_values() one by one.

This PR adds a decode() method to the submessage itself, allowing users to directly decode the submessages identified using the iterator.