Skip to content

Support alloc-backed APIs in no_std#403

Open
day01 wants to merge 1 commit into
statrs-dev:mainfrom
day01:feat/no-std-alloc-categorical
Open

Support alloc-backed APIs in no_std#403
day01 wants to merge 1 commit into
statrs-dev:mainfrom
day01:feat/no-std-alloc-categorical

Conversation

@day01

@day01 day01 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Motivation

This PR continues the work from #400 by extending no_std support to APIs that require heap allocation.

Types such as Vec and BTreeMap are provided by Rust's alloc crate and do not inherently require std. Using alloc allows these APIs to work in no_std.

Changes

  • migrate statrs-owned heap allocations from std to alloc
  • make Categorical, Empirical, log_spaced, ranks, and statistical tests available in no_std
  • enable matrix-backed distributions with nalgebra using its alloc and libm support
  • document allocator setup for no_std applications
  • add bare-metal checks for core-only, rand, nalgebra, and nalgebra,rand
  • add executable Wasm verification covering representative calculations

KDE cannot be migrated because its kdtree dependency requires std.

Verification

executable no_std calculations on wasm32-unknown-unknown

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.77%. Comparing base (1029458) to head (d7a0177).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #403   +/-   ##
=======================================
  Coverage   94.77%   94.77%           
=======================================
  Files          61       61           
  Lines       13402    13402           
=======================================
  Hits        12702    12702           
  Misses        700      700           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@day01 day01 mentioned this pull request Jul 20, 2026
11 tasks
@day01
day01 force-pushed the feat/no-std-alloc-categorical branch from 4407476 to d7a0177 Compare July 20, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant