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.
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.