gdext
gdext copied to clipboard
Implement GodotConvert for Vec<T>, [T] and &[T], where T: ArrayElement.
Rationale:
In multithreaded contexts, I've come across a use case where it was useful to express that a multithreaded operation would return a type that implements ToGodot
.
This is one of the cases, in my crate gdext_coroutines:
fn async_task<R>(
&self,
f: impl std::future::Future<Output = R> + Send + 'static,
) -> CoroutineBuilder<R>
where
R: 'static + ToGodot + Send;
Rust vectors and arrays fit all bounds of R
except ToGodot
, even if the element type implements ToGodot
.
The workaround is to use wrapper types and manually implement GodotConvert for them, but I believe this blanket implementation is simple enough to be worth improving the user experience.