Skip to content

Support no_std usage #463

@Pzixel

Description

@Pzixel

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 replace serde in dependencies with:

serde = { version = "1", default-features = false }

It almost compiled, however I've got several erros. One of them is was

error[E0407]: method `visit_string` is not a member of trait `Visitor`
  --> C:\Users\Alex\Documents\Repo\json\src\value\de.rs:76:13
   |
76 | /             fn visit_string<E>(self, value: String) -> Result<Value, E> {
77 | |                 Ok(Value::String(value))
78 | |             }
   | |_____________^ not a member of trait `Visitor`

It's because Visitor trait has cfg attribute:

#[cfg(any(feature = "std", feature = "alloc"))]
fn visit_string<E>(self, value: String) -> Result<Value, E>;

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions