Commit a6f71ba
feat!: migrate native extension from C to Rust (#44)
* feat!: migrate native extension from C to Rust
Complete rewrite of the native extension using Rust and the Magnus crate
instead of C. This maintains the same public API while providing better
memory safety and modern tooling.
- Replace all C source files with Rust implementation
- Add Cargo workspace and build configuration
- Update gem specification for Rust compilation
- Modernize codebase with frozen string literals
- Update CI pipeline to support Rust builds
- Bump version to 2.0.0-pre for major release
BREAKING CHANGE: Build system now requires Rust toolchain instead of C compiler
* Update ext/ruby_native_statistics/src/lib.rs
Co-authored-by: Copilot <[email protected]>
* refactor: use slice-based helpers to reduce code duplication in variance/stdev functions
- Add calculate_variance() and calculate_stdev() helper functions that work with slices
- Eliminate duplicated variance calculation logic across var, stdev, varp, stdevp functions
- Use population parameter to distinguish between sample and population statistics
- Replace length == 0.0 checks with more idiomatic array.is_empty()
- Maintain Vec usage only where necessary (median, percentile need sorting)
---------
Co-authored-by: Copilot <[email protected]>1 parent fd775d6 commit a6f71ba
File tree
26 files changed
+661
-443
lines changed- .github/workflows
- ext/ruby_native_statistics
- src
- lib
- ruby_native_statistics
- test
26 files changed
+661
-443
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | 6 | | |
10 | 7 | | |
11 | 8 | | |
12 | | - | |
13 | 9 | | |
14 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
15 | 14 | | |
16 | | - | |
17 | | - | |
18 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments