gdext icon indicating copy to clipboard operation
gdext copied to clipboard

Implement GodotConvert for Vec<T>, [T] and &[T], where T: ArrayElement.

Open Houtamelo opened this issue 7 months ago • 2 comments

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.

Houtamelo avatar Jul 12 '24 05:07 Houtamelo