image-rs / jpeg-decoder

JPEG decoder written in Rust
Apache License 2.0
149 stars 87 forks source link

Add no_std support #226

Open vstroebel opened 2 years ago

vstroebel commented 2 years ago

This is my attempt to make this crate usable on no_std.

I've splitted this changes into several commits to make it easier to review:

  1. Introduce trait JpegRead as an replacement for std::io::Read. On std JpegRead is implemented for every std::io:::Read which should allow users to use every type implementing Read, too.
  2. Some use relate changes that #196 didn't cover
  3. Integer only replacement for f32::ceil based code that isn't available in ´core´
  4. An ugly replacement for f32::fract. Maybe someone has a better idea to implement this for no_std.
  5. An integration test that works on no_std. The integration test suite heavily depends on file system ops and the png crate. Having at least one test that works on no_std is better than nothing....
  6. Add a std feature and use it as a marker for std/no_std.
  7. Change github action to test std and no_std code

This should fix #199