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

Validated/no_std: replace std::Vec dependency with alloc::Vec #220

Open
mammothbane opened this issue Jul 13, 2023 · 2 comments
Open

Validated/no_std: replace std::Vec dependency with alloc::Vec #220

mammothbane opened this issue Jul 13, 2023 · 2 comments

Comments

@mammothbane
Copy link

Would you be open to a PR to conditionally replace the use of std::Vec in frunk::Validated with alloc::Vec? At a quick glance, I believe this is the only required change to make the whole project work in no_std-but-alloc environments.

@ExpHP
Copy link
Collaborator

ExpHP commented Jul 13, 2023

Does it need to be conditional? I'm not familiar with usage of or best practices involving the alloc crate, but I would suspect that if it is possible to always use alloc over std when possible then that would be preferred.

@ExpHP
Copy link
Collaborator

ExpHP commented Jul 13, 2023

Oh yeah, I just remembered we have this:

#[cfg(not(feature = "std"))]
extern crate core as std;

Not 100% sure but I think that's a relic from a time back when you couldn't use core:: without no_std?? These days you can use use core:: from any crate and that's what I think we ought to be doing for the things that don't require std.

Edit: hmm yeah, I wrote that line ages ago but didn't document why. Either it was needed at the time, or I was simply too lazy to fix all of our uses across the crate, but it seems worth doing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants