wain icon indicating copy to clipboard operation
wain copied to clipboard

Introduce support for environments where the standard library is not available (#![no_std]) but a global allocator is

Open IntegralPilot opened this issue 7 months ago • 2 comments

This PR introduces support for environments where the standard library is not available but a global allocator is (i.e. embedded usecase) to the "subcrates" in this repository - wain-ast, wain-syntax-text, wain-syntax-binary, wain-validate and wain-exec.

wain-ast:

  • Support added without needing a feature to be enabled.
  • Incremented semver "minor" version so package version is now 0.3.0.

wain-exec:

  • Support added and locked behind no_std non-default feature.
  • This is because to add support a dependency is required on libm - this is only included with the no_std feature to make the claim that "no other dependencies are used" true for the default featureset.
  • Incremented semver "minor" version so package version is now 0.4.0.
  • execute function and DefaultImporter are not available when the no_std feature is enabled - developers who wish to use this feature need to create their own Importer and use runtime APIs to create and run a Runtime that uses it.

wain-syntax-binary:

  • Support added without needing a feature to be enabled.
  • Incremented semver "minor" version so package version is now 0.2.0.

wain-syntax-text:

  • Support added and locked behind no_std non-default feature.
  • This is because to add support a dependency is required on libm and hashbrown - this is only included with the no_std feature to make the claim that "no other dependencies are used" true for the default featureset.
  • Incremented semver "minor" version so package version is now 0.3.0.

wain-validate:

  • Support added and locked behind no_std non-default feature.
  • This is because to add support a dependency is required on hashbrown - this is only included with the no_std feature to make the claim that "no other dependencies are used" true for the default featureset.
  • Incremented semver "minor" version so package version is now 0.2.0.

Additionally, post-commit hooks were failing due to Clippy identified "dead code" in spec-test. I did not alter the code in spec-test to introduce #![no_std] support however have commented out the code that turned out to be actually dead and added Clippy ignore directives to the code that was being used in the tests but not detected by Clippy, in order to get these checks to pass and resolve all Clippy warnings.

If you decide to approve this PR, can you please deploy the new versions of the crates to crates.io so that I can use them more easily in my project?

Thank you for your time!

IntegralPilot avatar Jul 21 '24 09:07 IntegralPilot