memorysafety / zlib-rs

A safer zlib
zlib License
75 stars 6 forks source link

feat: no_std #97

Closed JonasKruckenberg closed 1 month ago

JonasKruckenberg commented 1 month ago

As promised: This PR adds no_std support to zlib-rs, by adding two new feature flags std and alloc that hide related functionality behind them (enabled by default).

I also had to disable the auto-detection of features which is not yet exposed through feature flags.

codecov[bot] commented 1 month ago

Codecov Report

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

Project coverage is 90.60%. Comparing base (751c803) to head (91ddd87).

:exclamation: Current head 91ddd87 differs from pull request most recent head 81c3a2e. Consider uploading reports for the commit 81c3a2e to get more accurate results

Files Patch % Lines
zlib-rs/src/read_buf.rs 55.55% 4 Missing :warning:
zlib-rs/src/deflate/algorithm/stored.rs 66.66% 2 Missing :warning:
zlib-rs/src/inflate.rs 94.87% 2 Missing :warning:
zlib-rs/src/adler32/avx2.rs 0.00% 1 Missing :warning:
zlib-rs/src/allocate.rs 98.68% 1 Missing :warning:
zlib-rs/src/deflate.rs 98.41% 1 Missing :warning:
zlib-rs/src/inflate/bitreader.rs 75.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #97 +/- ## ========================================== + Coverage 87.64% 90.60% +2.95% ========================================== Files 34 36 +2 Lines 8790 9181 +391 ========================================== + Hits 7704 8318 +614 + Misses 1086 863 -223 ```

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

folkertdev commented 1 month ago

I made it so that cargo check at least works for --target thumbv7em-none-eabihf now with the zlib-rs crate itself. If you're OK with some API breakage in the future that should provide everything you need to play around with this I think.

But maybe not, let me know. Also

folkertdev commented 1 month ago

turns out I can force push. I think this is ready to merge, but would like to try it out on actual embedded hardware just to make sure there are no unexpected issues. I'll try to do that tomorrow