milkey-mouse / planets

A space game.
GNU General Public License v3.0
3 stars 1 forks source link

why are we assigning to a variable? #21

Closed todo[bot] closed 5 years ago

todo[bot] commented 5 years ago

I just copied this from the vulkan tutorial verbatim.

https://github.com/milkey-mouse/planets/blob/71d957a2893b87a0341a566c3ee399b2af3acb37/src/main.rs#L492-L497


This issue was generated by todo based on a // TODO: comment in 71d957a2893b87a0341a566c3ee399b2af3acb37. It's been assigned to @milkey-mouse because they committed the code.
milkey-mouse commented 5 years ago

A: Because that's the most convenient way to specify that we only care about the Arc's contents implementing FramebufferAbstract + Send + Sync and not all of this:

error[E0277]: a collection of type `std::vec::Vec<std::sync::Arc<dyn vulkano::framebuffer::traits::FramebufferAbstract + std::marker::Send + std::marker::Sync>>` cannot be built from an iterator over elements of type `std::sync::Arc<vulkano::framebuffer::framebuffer::Framebuffer<std::sync::Arc<dyn vulkano::framebuffer::traits::RenderPassAbstract + std::marker::Send + std::marker::Sync>, ((), std::sync::Arc<vulkano::image::swapchain::SwapchainImage<winit::Window>>)>>`
   --> src/main.rs:496:14
    |
496 |             .collect()
    |              ^^^^^^^ a collection of type `std::vec::Vec<std::sync::Arc<dyn vulkano::framebuffer::traits::FramebufferAbstract + std::marker::Send + std::marker::Sync>>` cannot be built from `std::iter::Iterator<Item=std::sync::Arc<vulkano::framebuffer::framebuffer::Framebuffer<std::sync::Arc<dyn vulkano::framebuffer::traits::RenderPassAbstract + std::marker::Send + std::marker::Sync>, ((), std::sync::Arc<vulkano::image::swapchain::SwapchainImage<winit::Window>>)>>>`
    |
    = help: the trait `std::iter::FromIterator<std::sync::Arc<vulkano::framebuffer::framebuffer::Framebuffer<std::sync::Arc<dyn vulkano::framebuffer::traits::RenderPassAbstract + std::marker::Send + std::marker::Sync>, ((), std::sync::Arc<vulkano::image::swapchain::SwapchainImage<winit::Window>>)>>>` is not implemented for `std::vec::Vec<std::sync::Arc<dyn vulkano::framebuffer::traits::FramebufferAbstract + std::marker::Send + std::marker::Sync>>`

Yuck.