gtk-rs-core
gtk-rs-core copied to clipboard
Functions taking `&[T]` might be more generic with `impl IntoIterator<Item = T>`
We have various functions that take a slice as argument currently. Most of them would convert the slice into a Vec<*mut _>
or similar before passing to C functions. As such it would make sense to directly allow using anything that can be iterated over.
For functions taking some plain type T
this is straightforward (e.g. &[&str]
would become impl IntoIterator<Item = &str>
), for functions taking a &dyn T
(e.g. &[&dyn ToValue]
) this is a bit problematic because of https://github.com/rust-lang/rust/issues/89222.
Because of that I would suggest to only do it for slices that are not containing trait objects for now, unless someone knows a way around that.
@bilelmoussaoui @GuillaumeGomez Any opinions?
If the compiler errors are acceptable, then why not.