Skip to content

Make no-std compatible #232

@stargazing-dino

Description

@stargazing-dino

After reading the bevy 0.16 release, I'm very excited for no-std. I'd love to see this package also head in that direction

I've had a quick look around the codebase and would likely do:

  1. Core migration
  • Add std feature flag (enabled by default)
  • Replace all usages of std and replace with core alternatives
  • Conditional imports for some imports:
// I think this is how they do it?
#[cfg(feature = "std")]
use std::collections::HashMap;
#[cfg(not(feature = "std"))]
use alloc::collections::HashMap;

For dependencies:

Dependency no-std compatible
prost ✔️
serde ✔️
bevy ✔️
variadics_please ✔️
  1. Runtime migration
  • Add std feature flag (enabled by default)
  • Replace all usages of std and replace with core alternatives
  • Allow for platform-agnostic alternatives:
Dependency no-std compatible
unicode-normalization ✔️
unicode-segmentation ✔️
bevy ✔️
variadics_please ✔️
log ?
icu_plurals ✔️
icu_locid ✔️
fixed_decimal ✔️
once_cell ✔️
regex ✔️
serde ✔️
  1. Compiler

I guess the compiler could stay std. Not sure really. antlr-rust last update was 3 years ago, but its usages of std also don't seem super platform dependent.

The last consideration would be to get some tests up and early. Bevy has some that build to wasm targets which should be feasible to adapt.

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