-
Notifications
You must be signed in to change notification settings - Fork 580
Support no_std
usage
#463
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
Comments
Please use |
It seems pretty easy to solve these three issues to make it non-std compatible. It probably won't be a good way to run it on devices with limited CPU/memory capabilities, but there still plenty of powerful devices that require no_std target. So either |
I am closing the issue because I don't intend to bring no-std support into serde_json as discussed previously in #362.
I'm afraid I don't understand what |
@dtolnay I have several considerations
#[cfg(any(feature = "std", feature = "alloc"))] If you don't want to support But as I said, it hasyou have to fix only 3 places via Author explicitely says:
So if I have struct with |
I'm currently in the situration where I need to serialize some In a nutshell: I'm writing a library for wasm. So I need to run without standard library ( |
I crated a question about it, if you are insterested: https://users.rust-lang.org/t/how-to-serialize-json-in-no-std-library/18915 |
I would be willing to consider a PR that adds a |
I'm working on
no_std
library and I encountered a problem with serde that it doesn't work when I compile for the target (see openethereum/pwasm-abi#54 ). After some investigation I found that it seems evildoer is this crate. So I tried to replaceserde
in dependencies with:serde = { version = "1", default-features = false }
It almost compiled, however I've got several erros. One of them is was
It's because
Visitor
trait has cfg attribute:When implementation - doesn't.
It seems that the crate was never tested against no_std environments (sorry if I'm wrong).
I could try to fix all issues myself and create a PR, but I'm not sure that I'm doing the right thing or don't.
Please, see referenced issue if you want to know why I came here with this proposal.
The text was updated successfully, but these errors were encountered: