dropbox / dropbox/rust-brotli-decompressor
How do you use this crate on no_std?
- Dominant language
- Rust
- Stars
- 61
- Forks
- 30
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 10
Description
I've tried to decode some data from a `&[u8]` into a `alloc::vec::Vec`. For some reason, this crate requires `std::io::Read` - but that trait is not available on `no_std`. I've tried for the past two hours to decipher the unreadable mess that is this codebase in order to just write a function like this:
```rust
#![no_std]
extern crate alloc; // use standard allocator
fn decode_my_data(input: &[u8]) -> Result, BrotliError>
```
I'm sorry if this comes off as rude, but the code is completely unreadable, there's no documentation and no examples for `no_std` use-cases, even though it seems that this crate does support `no_std` (it says so in the project description)? Maybe this is due to this crate being written before certain Rust features were available, but still - if you'd want custom allocators, why not just let users pass in `malloc` and `free` function pointers instead of this generic mess:

Effectively, this crate only compiles on `std` because the code is too much of a mess. It doesn't seem possible to run the decoding function without the buffer implementing `std::io::Read` - which is *not available on `no_std`*. I tried to port the `decode` function by copying the implementation in the `Read` trait, but for some reason the code uses things like `input_buffer` as an output buffer and does some copy-in-place tricks, which is confusing. Maybe it's possible to run it on `no_std`, but the code is simply too complex for me to know which traits / types I should use. I'd appreciate any help / examples.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.