bitcode icon indicating copy to clipboard operation
bitcode copied to clipboard

Support using without `alloc`

Open katyo opened this issue 1 year ago • 1 comments

I try this awesome library to create firmware for microcontrollers. Because it supports no_std I expected it works but seems currently Encoder and Decoder implementations uses Vec type from std/alloc. I got the following errors:

error[E0412]: cannot find type `Vec` in this scope

I added dependency as follows:

[dependencies.bitcode]
version = "0.6"
default-features = false
features = ["derive"]

Is it possible to use this crate without std and alloc at all?

katyo avatar Aug 04 '24 06:08 katyo

bitcode needs alloc (see the README)

Dropping the alloc dependency would require some redesigning and refactoring, and would probably add complexity. You're welcome to try writing a PR to do it (I'd be interested to see how far you can get). I anticipate you would need to use a lot of stack-allocated, fixed-sized vectors that abort instead of growing.

finnbear avatar Aug 04 '24 17:08 finnbear