Skip to content

Possible no_std support #5

@xxuejie

Description

@xxuejie

Hi there,

I was trying to use bcs in an environment without std support, after some hacking, I've put together a commit that compiles in a no_std environment: xxuejie@7e6b1f3 Some of my changes include:

  • Switch from std to core for components that exist in both crates, such as core::result::Result
  • Use Vec and String from alloc instead of std
  • Add a just-enough io module in no_std environment to minimize changes to existing logic
  • (Perhaps the most controversial one), I have to use onlyerror, which is like thiserror but works in no_std environment. And for this to work I have to switch to a nightly version of Rust, since core::error::Error is not stable yet. An alternative path is what postcard does now, but we lose the custom message

So my question here is: is no_std support that you would consider to be accepted to upstream? And if so, how do you suggest we deal with the thiserror issue?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions