Ogeon / palette

A Rust library for linear color calculations and conversion
Apache License 2.0
756 stars 60 forks source link

Make hue `::from_degrees` and some `palette::cast::*` functions `const fn` #405

Closed Ogeon closed 4 months ago

Ogeon commented 4 months ago

This makes the following functions const fn, as allowed by Rust 1.61.0:

codspeed-hq[bot] commented 4 months ago

CodSpeed Performance Report

Merging #405 will degrade performances by 11.73%

Comparing const_fn (13368ac) with master (afa3b12)

Summary

❌ 1 regressions ✅ 45 untouched benchmarks

:warning: _Please fix the performance issues or acknowledge them on CodSpeed._

Benchmarks breakdown

Benchmark master const_fn Change
matrix_inverse 438.9 ns 497.2 ns -11.73%
codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 82.66%. Comparing base (afa3b12) to head (13368ac).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #405 +/- ## ========================================== - Coverage 82.66% 82.66% -0.01% ========================================== Files 127 127 Lines 19545 19539 -6 Branches 19545 19539 -6 ========================================== - Hits 16157 16151 -6 Misses 3285 3285 Partials 103 103 ``` | [Components](https://app.codecov.io/gh/Ogeon/palette/pull/405/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Hedvall) | Coverage Δ | | |---|---|---| | [palette](https://app.codecov.io/gh/Ogeon/palette/pull/405/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Hedvall) | `82.71% <100.00%> (-0.01%)` | :arrow_down: | | [palette_derive](https://app.codecov.io/gh/Ogeon/palette/pull/405/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Hedvall) | `81.98% <ø> (ø)` | |