Skip to content

Interest in no_std + alloc support? #2

@lilith

Description

@lilith

Hi! I'm interested in using quantizr in a no_std environment (embedded/WASM use cases).

I've prepared a PR (#2) that adds no_std + alloc support with minimal changes:

Changes:

  • Conditional #![no_std] when std feature is disabled
  • Use hashbrown::HashMap in no_std mode (std mode uses std::collections::HashMap)
  • Use num-traits with libm for f32 math methods (sqrt, round, powf) in no_std
  • Replace std::archcore::arch, std::fmtcore::fmt, etc.
  • Use core::error::Error (stable since Rust 1.81)

Usage:

# Default (std) - no change
quantizr = "1.4.3"

# no_std + alloc
quantizr = { version = "1.4.3", default-features = false }

Dependencies added:

  • hashbrown (only used in no_std mode)
  • num-traits with libm feature (only used in no_std mode)

All existing tests pass, and the crate builds successfully on thumbv7em-none-eabihf.

Would you be interested in this functionality? Happy to adjust the implementation based on feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions