Ogeon / palette

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

Add in-place conversion traits for slices and references #257

Closed Ogeon closed 3 years ago

Ogeon commented 3 years ago

A number of traits have been added, that allow colors and slices of colors to be converted in place and later restored back to their original type. This operation is guarded by a scope guard that makes sure the restoration happens when it's dropped at the end of the scope, if not earlier. The &mut reference and the scope guard will also prevent the values from being accessed as the wrong type while the guard is still in scope.

This is a variant of the "scopes" idea from https://github.com/Ogeon/palette/discussions/197.

Ogeon commented 3 years ago

bors r+

bors[bot] commented 3 years ago

Build succeeded: