You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed in #303, it would be useful to have an interface for converting an array/Vec of colors to and from Struct of Arrays format. The first step should be:
Construction of Rgb<S, Vec<T>> from some I: IntoIterator<Item = Rgb<S, T>>, and the same for the other color types.
Make it possible to get a color at some index. For example fn get_mut(&mut self, index: usize) -> Option<Rgb<S, &mut T>>.
Make it possible to iterate over the colors. For example fn iter_mut(&mut self) -> impl Iterator<Item = Rgb<S, &mut T>.
Make it simple to read from and assign to colors with reference components, such as Rgb<S, &mut T>.
Add counterparts to Vec::clear and Vec::extend.
Make it possible to push and pop individual colors.
In addition to that, we may want to add chunks and windows iterators.
The reference components will likely be necessary, due to the split into separate arrays, unless there's a smarter solution. They don't have to enable much more than reading and writing, though. It's also what would make it hard to implement the Index and IndexMut traits, if possible at all.
Motivation
The discussions in #303 covers it pretty well. One of the main reasons for a built-in interface is that it gives a way to correctly preserve the color type information across conversions. It also lowers the bar for working with SoA data.
The text was updated successfully, but these errors were encountered:
Another feature that I think would be useful is some way to reuse the existing allocations. It might be an extend-like interface so that users could call clear on the existing data and re-initialize with an iterator.
Description
As discussed in #303, it would be useful to have an interface for converting an array/
Vec
of colors to and from Struct of Arrays format. The first step should be:Rgb<S, Vec<T>>
from someI: IntoIterator<Item = Rgb<S, T>>
, and the same for the other color types.fn get_mut(&mut self, index: usize) -> Option<Rgb<S, &mut T>>
.fn iter_mut(&mut self) -> impl Iterator<Item = Rgb<S, &mut T>
.Rgb<S, &mut T>
.Vec::clear
andVec::extend
.In addition to that, we may want to add chunks and windows iterators.
The reference components will likely be necessary, due to the split into separate arrays, unless there's a smarter solution. They don't have to enable much more than reading and writing, though. It's also what would make it hard to implement the
Index
andIndexMut
traits, if possible at all.Motivation
The discussions in #303 covers it pretty well. One of the main reasons for a built-in interface is that it gives a way to correctly preserve the color type information across conversions. It also lowers the bar for working with SoA data.
The text was updated successfully, but these errors were encountered: