jhelovuo / RustDDS

Rust implementation of Data Distribution Service
Apache License 2.0
316 stars 65 forks source link

Try eliminate some `unwrap` calls. #331

Closed LebranceBW closed 5 months ago

codecov-commenter commented 5 months ago

Codecov Report

Attention: Patch coverage is 73.91304% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 73.53%. Comparing base (28ed26f) to head (8df9df7). Report is 131 commits behind head on master.

Files Patch % Lines
src/dds/with_key/datareader.rs 0.00% 5 Missing :warning:
src/dds/with_key/datasample_cache.rs 94.44% 1 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #331 +/- ## ========================================== - Coverage 73.53% 73.53% -0.01% ========================================== Files 94 95 +1 Lines 19845 20011 +166 ========================================== + Hits 14594 14716 +122 - Misses 5251 5295 +44 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jhelovuo commented 5 months ago

Merged this PR, but with some heavy modifications.

Adding a trait SafeAcquire does not make any sense, especially when the only method is essentially lock-or-panic, so not safe. However, there was some room for improvement for locking failure.

The changes in datasample_cache are overkill, because these functions are meant to be used only from DataReader, and only with arguments obtained from one of the selection functions in this same object. Those functions will always produce valid keys. Added some comments to draw attention to this. Restricting the visibility of the function to only the parent module was a clever idea.