Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: no-alloc as option for ciborium #90

Open
1 task done
chrysn opened this issue Aug 24, 2023 · 0 comments
Open
1 task done

[Feature]: no-alloc as option for ciborium #90

chrysn opened this issue Aug 24, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@chrysn
Copy link

chrysn commented Aug 24, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Description

While some parts of the high-level ciborium crate by their nature require alloc (in particular, Value doesn't work without), most of it should manage well without.

It'd be great if structs with serde based serializations could be used on embedded targets where alloc is typically unavailable.

Acceptance Criteria

The encode_vec test works when replacing the Vec with a heapless::vec in a build configuration that does not use extern crate alloc.

The crate is added to the category no-std::no-alloc in its Cargo.toml.

Suggestions for a technical implementation

ciborium could introduce a crate feature alloc that is in the default set.

Then, parts of the library that depend on alloc are marked #[cfg(feature=alloc)].

As the crate is already no-std, the relevant parts should be trivially discoverable by grepping for alloc, and further grepping for the names of all types that get disabled without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: New
Development

No branches or pull requests

1 participant